lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/search PhrasePrefixQuery.java PhraseQuery.java TermQuery.java
Date Mon, 15 Dec 2003 22:26:13 GMT
cutting     2003/12/15 14:26:13

  Modified:    src/java/org/apache/lucene/search PhrasePrefixQuery.java
                        PhraseQuery.java TermQuery.java
  Log:
  Fixed a NPE in Query.explain().
  
  Revision  Changes    Path
  1.10      +4 -1      jakarta-lucene/src/java/org/apache/lucene/search/PhrasePrefixQuery.java
  
  Index: PhrasePrefixQuery.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/PhrasePrefixQuery.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PhrasePrefixQuery.java	28 Nov 2003 17:03:25 -0000	1.9
  +++ PhrasePrefixQuery.java	15 Dec 2003 22:26:13 -0000	1.10
  @@ -212,7 +212,10 @@
         fieldExpl.addDetail(idfExpl);
   
         Explanation fieldNormExpl = new Explanation();
  -      fieldNormExpl.setValue(Similarity.decodeNorm(reader.norms(field)[doc]));
  +      byte[] fieldNorms = reader.norms(field);
  +      float fieldNorm =
  +        fieldNorms!=null ? Similarity.decodeNorm(fieldNorms[doc]) : 0.0f;
  +      fieldNormExpl.setValue(fieldNorm);
         fieldNormExpl.setDescription("fieldNorm(field="+field+", doc="+doc+")");
         fieldExpl.addDetail(fieldNormExpl);
   
  
  
  
  1.12      +4 -1      jakarta-lucene/src/java/org/apache/lucene/search/PhraseQuery.java
  
  Index: PhraseQuery.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/PhraseQuery.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PhraseQuery.java	29 Jan 2003 17:18:55 -0000	1.11
  +++ PhraseQuery.java	15 Dec 2003 22:26:13 -0000	1.12
  @@ -210,7 +210,10 @@
         fieldExpl.addDetail(idfExpl);
   
         Explanation fieldNormExpl = new Explanation();
  -      fieldNormExpl.setValue(Similarity.decodeNorm(reader.norms(field)[doc]));
  +      byte[] fieldNorms = reader.norms(field);
  +      float fieldNorm =
  +        fieldNorms!=null ? Similarity.decodeNorm(fieldNorms[doc]) : 0.0f;
  +      fieldNormExpl.setValue(fieldNorm);
         fieldNormExpl.setDescription("fieldNorm(field="+field+", doc="+doc+")");
         fieldExpl.addDetail(fieldNormExpl);
   
  
  
  
  1.8       +4 -1      jakarta-lucene/src/java/org/apache/lucene/search/TermQuery.java
  
  Index: TermQuery.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/TermQuery.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TermQuery.java	15 Jan 2003 19:25:04 -0000	1.7
  +++ TermQuery.java	15 Dec 2003 22:26:13 -0000	1.8
  @@ -139,7 +139,10 @@
         fieldExpl.addDetail(idfExpl);
   
         Explanation fieldNormExpl = new Explanation();
  -      fieldNormExpl.setValue(Similarity.decodeNorm(reader.norms(field)[doc]));
  +      byte[] fieldNorms = reader.norms(field);
  +      float fieldNorm =
  +        fieldNorms!=null ? Similarity.decodeNorm(fieldNorms[doc]) : 0.0f;
  +      fieldNormExpl.setValue(fieldNorm);
         fieldNormExpl.setDescription("fieldNorm(field="+field+", doc="+doc+")");
         fieldExpl.addDetail(fieldNormExpl);
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message