lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r911552 - in /lucene/java/branches/lucene_2_9: CHANGES.txt src/java/org/apache/lucene/search/Query.java
Date Thu, 18 Feb 2010 20:25:17 GMT
Author: yonik
Date: Thu Feb 18 20:25:17 2010
New Revision: 911552

URL: http://svn.apache.org/viewvc?rev=911552&view=rev
Log:
LUCENE-2770: fix query normalization when boosts of all clauses==0

Modified:
    lucene/java/branches/lucene_2_9/CHANGES.txt
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/Query.java

Modified: lucene/java/branches/lucene_2_9/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/CHANGES.txt?rev=911552&r1=911551&r2=911552&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/CHANGES.txt (original)
+++ lucene/java/branches/lucene_2_9/CHANGES.txt Thu Feb 18 20:25:17 2010
@@ -44,6 +44,10 @@
    only one payload is present.  (Erik Hatcher, Mike McCandless
    via Uwe Schindler)
 
+ * LUCENE-2770: Queries consisting of all zero-boost clauses
+   (for example, text:foo^0) sorted incorrectly and produced
+   invalid docids. (yonik)
+
 API Changes
 
  * LUCENE-2190: Added setNextReader method to CustomScoreQuery, which

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/Query.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/Query.java?rev=911552&r1=911551&r2=911552&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/Query.java (original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/Query.java Thu Feb 18
20:25:17 2010
@@ -99,6 +99,8 @@
     Weight weight = query.createWeight(searcher);
     float sum = weight.sumOfSquaredWeights();
     float norm = getSimilarity(searcher).queryNorm(sum);
+    if (Float.isInfinite(norm) || Float.isNaN(norm))
+      norm = 1.0f;
     weight.normalize(norm);
     return weight;
   }



Mime
View raw message