Skip to content

Apache Lucene open-source search software

LUCENE-1602: Fix incomplete toString(), hashcode() and equals() because boost was not involved there (copy'n'paste error from the Filter, which had no boost)

Uwe Schindler5807d11b70f5
diff --git a/contrib/queries/src/java/org/apache/lucene/search/trie/AbstractTrieRangeQuery.java b/contrib/queries/src/java/org/apache/lucene/search/trie/AbstractTrieRangeQuery.java
index d9a9d2a6224..86f78e664ee 100644
--- a/contrib/queries/src/java/org/apache/lucene/search/trie/AbstractTrieRangeQuery.java
+++ b/contrib/queries/src/java/org/apache/lucene/search/trie/AbstractTrieRangeQuery.java
@@ -66,7 +66,9 @@ abstract class AbstractTrieRangeQuery extends MultiTermQuery {
.append((min==null) ? "*" : min.toString())
.append(" TO ")
.append((max==null) ? "*" : max.toString())
- .append(maxInclusive ? ']' : '}').toString();
+ .append(maxInclusive ? ']' : '}')
+ .append(ToStringUtils.boost(getBoost()))
+ .toString();
}
//@Override
@@ -81,7 +83,8 @@ abstract class AbstractTrieRangeQuery extends MultiTermQuery {
(q.max == null ? max == null : q.max.equals(max)) &&
minInclusive==q.minInclusive &&
maxInclusive==q.maxInclusive &&
- precisionStep==q.precisionStep
+ precisionStep==q.precisionStep &&
+ getBoost()==q.getBoost()
);
}
return false;
@@ -89,7 +92,8 @@ abstract class AbstractTrieRangeQuery extends MultiTermQuery {
//@Override
public final int hashCode() {
- int hash = field.hashCode() + (precisionStep^0x64365465);
+ int hash = Float.floatToIntBits(getBoost()) ^ field.hashCode();
+ hash += precisionStep^0x64365465;
if (min!=null) hash += min.hashCode()^0x14fa55fb;
if (max!=null) hash += max.hashCode()^0x733fa5fe;
return hash+