Index: lucene/core/src/java/org/apache/lucene/search/NumericRangeQuery.java =================================================================== --- lucene/core/src/java/org/apache/lucene/search/NumericRangeQuery.java (revision 1363038) +++ lucene/core/src/java/org/apache/lucene/search/NumericRangeQuery.java (working copy) @@ -173,35 +173,6 @@ 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 @@ @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) min).compareTo(max) > 0) ? - TermsEnum.EMPTY : - new NumericRangeTermsEnum(terms.iterator(null)); + if (min != null && max != null && ((Comparable) min).compareTo(max) > 0) { + return TermsEnum.EMPTY; + } + return new NumericRangeTermsEnum(terms.iterator(null)); } /** Returns true if the lower endpoint is inclusive */ Index: lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java =================================================================== --- lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java (revision 1363038) +++ lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java (working copy) @@ -211,7 +211,6 @@ @Test public void testOneMatchQuery() throws Exception { NumericRangeQuery 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); Index: lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java =================================================================== --- lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java (revision 1363038) +++ lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java (working copy) @@ -226,7 +226,6 @@ @Test public void testOneMatchQuery() throws Exception { NumericRangeQuery 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);