lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r1363051 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/core/src/java/org/apache/lucene/search/ lucene/core/src/test/org/apache/lucene/search/
Date Wed, 18 Jul 2012 19:10:10 GMT
Author: uschindler
Date: Wed Jul 18 19:10:10 2012
New Revision: 1363051

URL: http://svn.apache.org/viewvc?rev=1363051&view=rev
Log:
Merged revision(s) 1363049 from lucene/dev/trunk:
LUCENE-4235: Remove enforcing of Filter rewrite for NRQ queries

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/CHANGES.txt
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/NumericRangeQuery.java
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java

Modified: lucene/dev/branches/branch_4x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/CHANGES.txt?rev=1363051&r1=1363050&r2=1363051&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/lucene/CHANGES.txt Wed Jul 18 19:10:10 2012
@@ -54,6 +54,9 @@ Optimizations
 * LUCENE-4184: Performance improvements to the aligned packed bits impl.
   (Toke Eskildsen, Adrien Grand)
 
+* LUCENE-4235: Remove enforcing of Filter rewrite for NRQ queries.
+  (Uwe Schindler)
+
 Bug Fixes
 
 * LUCENE-4176: Fix AnalyzingQueryParser to analyze range endpoints as bytes,

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/NumericRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/NumericRangeQuery.java?rev=1363051&r1=1363050&r2=1363051&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/NumericRangeQuery.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/NumericRangeQuery.java
Wed Jul 18 19:10:10 2012
@@ -173,35 +173,6 @@ public final class NumericRangeQuery<T e
     this.max = max;
     this.minInclusive = minInclusive;
     this.maxInclusive = maxInclusive;
-
-    // For bigger precisionSteps this query likely
-    // hits too many terms, so set to CONSTANT_SCORE_FILTER right off
-    // (especially as the FilteredTermsEnum is costly if wasted only for AUTO tests because
it
-    // creates new enums from IndexReader for each sub-range)
-    switch (dataType) {
-      case LONG:
-      case DOUBLE:
-        setRewriteMethod( (precisionStep > 6) ?
-          CONSTANT_SCORE_FILTER_REWRITE : 
-          CONSTANT_SCORE_AUTO_REWRITE_DEFAULT
-        );
-        break;
-      case INT:
-      case FLOAT:
-        setRewriteMethod( (precisionStep > 8) ?
-          CONSTANT_SCORE_FILTER_REWRITE : 
-          CONSTANT_SCORE_AUTO_REWRITE_DEFAULT
-        );
-        break;
-      default:
-        // should never happen
-        throw new IllegalArgumentException("Invalid numeric NumericType");
-    }
-    
-    // shortcut if upper bound == lower bound
-    if (min != null && min.equals(max)) {
-      setRewriteMethod(CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE);
-    }
   }
   
   /**
@@ -319,9 +290,10 @@ public final class NumericRangeQuery<T e
   @Override @SuppressWarnings("unchecked")
   protected TermsEnum getTermsEnum(final Terms terms, AttributeSource atts) throws IOException
{
     // very strange: java.lang.Number itsself is not Comparable, but all subclasses used
here are
-    return (min != null && max != null && ((Comparable<T>) min).compareTo(max)
> 0) ?
-      TermsEnum.EMPTY :
-      new NumericRangeTermsEnum(terms.iterator(null));
+    if (min != null && max != null && ((Comparable<T>) min).compareTo(max)
> 0) {
+      return TermsEnum.EMPTY;
+    }
+    return new NumericRangeTermsEnum(terms.iterator(null));
   }
 
   /** Returns <code>true</code> if the lower endpoint is inclusive */

Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java?rev=1363051&r1=1363050&r2=1363051&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
Wed Jul 18 19:10:10 2012
@@ -211,7 +211,6 @@ public class TestNumericRangeQuery32 ext
   @Test
   public void testOneMatchQuery() throws Exception {
     NumericRangeQuery<Integer> q = NumericRangeQuery.newIntRange("ascfield8", 8, 1000,
1000, true, true);
-    assertSame(MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, q.getRewriteMethod());
     TopDocs topDocs = searcher.search(q, noDocs);
     ScoreDoc[] sd = topDocs.scoreDocs;
     assertNotNull(sd);

Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java?rev=1363051&r1=1363050&r2=1363051&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
Wed Jul 18 19:10:10 2012
@@ -226,7 +226,6 @@ public class TestNumericRangeQuery64 ext
   @Test
   public void testOneMatchQuery() throws Exception {
     NumericRangeQuery<Long> q = NumericRangeQuery.newLongRange("ascfield8", 8, 1000L,
1000L, true, true);
-    assertSame(MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, q.getRewriteMethod());
     TopDocs topDocs = searcher.search(q, noDocs);
     ScoreDoc[] sd = topDocs.scoreDocs;
     assertNotNull(sd);



Mime
View raw message