mirror of https://github.com/apache/lucene.git
LUCENE-2270: fix query normalization when boosts of all clauses==0
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@911554 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5abaff61fa
commit
44a38e9837
|
@ -81,6 +81,11 @@ Bug fixes
|
|||
|
||||
* LUCENE-2249: ParallelMultiSearcher should shut down thread pool on
|
||||
close. (Martin Traverso via Uwe Schindler)
|
||||
|
||||
* LUCENE-2770: Queries consisting of all zero-boost clauses
|
||||
(for example, text:foo^0) sorted incorrectly and produced
|
||||
invalid docids. (yonik)
|
||||
|
||||
|
||||
New features
|
||||
|
||||
|
|
|
@ -101,6 +101,8 @@ public abstract class Query implements java.io.Serializable, Cloneable {
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue