You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by us...@apache.org on 2009/04/23 19:07:36 UTC

svn commit: r767982 - /lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/AbstractTrieRangeQuery.java

Author: uschindler
Date: Thu Apr 23 17:07:36 2009
New Revision: 767982

URL: http://svn.apache.org/viewvc?rev=767982&view=rev
Log:
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)

Modified:
    lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/AbstractTrieRangeQuery.java

Modified: lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/AbstractTrieRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/AbstractTrieRangeQuery.java?rev=767982&r1=767981&r2=767982&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/AbstractTrieRangeQuery.java (original)
+++ lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/AbstractTrieRangeQuery.java Thu Apr 23 17:07:36 2009
@@ -66,7 +66,9 @@
       .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 @@
         (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 @@
 
   //@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+