lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r883554 - in /lucene/java/trunk: CHANGES.txt common-build.xml src/java/org/apache/lucene/search/BooleanQuery.java src/test/org/apache/lucene/search/TestWildcard.java
Date Tue, 24 Nov 2009 00:04:21 GMT
Author: mikemccand
Date: Tue Nov 24 00:04:20 2009
New Revision: 883554

URL: http://svn.apache.org/viewvc?rev=883554&view=rev
Log:
LUCENE-2092: fix BooleanQuery.equals/hashCode to pay attention to disableCoord

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/common-build.xml
    lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestWildcard.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=883554&r1=883553&r2=883554&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Tue Nov 24 00:04:20 2009
@@ -13,6 +13,10 @@
 
 Bug fixes
 
+* LUCENE-2092: BooleanQuery was ignoring disableCoord in its hashCode
+  and equals methods, cause bad things to happen when caching
+  BooleanQueries.  (Chris Hostetter, Mike McCandless)
+
 New features
 
 Optimizations

Modified: lucene/java/trunk/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/common-build.xml?rev=883554&r1=883553&r2=883554&view=diff
==============================================================================
--- lucene/java/trunk/common-build.xml (original)
+++ lucene/java/trunk/common-build.xml Tue Nov 24 00:04:20 2009
@@ -42,7 +42,7 @@
   <property name="Name" value="Lucene"/>
   <property name="dev.version" value="3.1-dev"/>
   <property name="version" value="${dev.version}"/>
-  <property name="compatibility.tag" value="lucene_3_0_back_compat_tests_20091116"/>
+  <property name="compatibility.tag" value="lucene_3_0_back_compat_tests_20091123"/>
   <property name="spec.version" value="${version}"/>	
   <property name="year" value="2000-${current.year}"/>
   <property name="final.name" value="lucene-${name}-${version}"/>

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java?rev=883554&r1=883553&r2=883554&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java Tue Nov 24 00:04:20
2009
@@ -469,14 +469,15 @@
     BooleanQuery other = (BooleanQuery)o;
     return (this.getBoost() == other.getBoost())
         && this.clauses.equals(other.clauses)
-        && this.getMinimumNumberShouldMatch() == other.getMinimumNumberShouldMatch();
+        && this.getMinimumNumberShouldMatch() == other.getMinimumNumberShouldMatch()
+        && this.disableCoord == other.disableCoord;
   }
 
   /** Returns a hash code value for this object.*/
   @Override
   public int hashCode() {
     return Float.floatToIntBits(getBoost()) ^ clauses.hashCode()
-           + getMinimumNumberShouldMatch();
+      + getMinimumNumberShouldMatch() + (disableCoord ? 17:0);
   }
   
 }

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestWildcard.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestWildcard.java?rev=883554&r1=883553&r2=883554&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestWildcard.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestWildcard.java Tue Nov 24 00:04:20
2009
@@ -104,7 +104,7 @@
     MultiTermQuery wq = new WildcardQuery(new Term("field", ""));
     wq.setRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);
     assertMatches(searcher, wq, 0);
-    BooleanQuery expected = new BooleanQuery();
+    BooleanQuery expected = new BooleanQuery(true);
     assertEquals(searcher.rewrite(expected), searcher.rewrite(wq));
   }
   



Mime
View raw message