lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From busc...@apache.org
Subject svn commit: r713225 - in /lucene/java/trunk/src/java/org/apache/lucene/queryParser: QueryParser.java QueryParser.jj QueryParserTokenManager.java
Date Wed, 12 Nov 2008 00:01:52 GMT
Author: buschmi
Date: Tue Nov 11 16:01:52 2008
New Revision: 713225

URL: http://svn.apache.org/viewvc?rev=713225&view=rev
Log:
LUCENE-1424: Changed QueryParser#newRangeQuery() to return a ConstantScoreRangeQuery to make
backwards-compatibility tests pass again; this does not change any behavior since ConstantScoreRangeQuery
subclasses RangeQuery

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java
    lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj
    lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParserTokenManager.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java?rev=713225&r1=713224&r2=713225&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java Tue Nov 11 16:01:52
2008
@@ -21,6 +21,7 @@
 import org.apache.lucene.index.Term;
 import org.apache.lucene.search.BooleanClause;
 import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.ConstantScoreRangeQuery;
 import org.apache.lucene.search.FuzzyQuery;
 import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.lucene.search.MultiPhraseQuery;
@@ -753,7 +754,14 @@
    * @return new RangeQuery instance
    */
   protected Query newRangeQuery(String field, String part1, String part2, boolean inclusive)
{
-    RangeQuery query = new RangeQuery(field, part1, part2, inclusive, inclusive, rangeCollator);
+    RangeQuery query;
+
+    if (constantScoreRewrite) {
+      // TODO: remove in Lucene 3.0
+      query = new ConstantScoreRangeQuery(field, part1, part2, inclusive, inclusive, rangeCollator);
+    } else {
+      query = new RangeQuery(field, part1, part2, inclusive, inclusive, rangeCollator);
+    }
     query.setConstantScoreRewrite(constantScoreRewrite);
     return query;
   }
@@ -1495,6 +1503,12 @@
     finally { jj_save(0, xla); }
   }
 
+  private boolean jj_3R_3() {
+    if (jj_scan_token(STAR)) return true;
+    if (jj_scan_token(COLON)) return true;
+    return false;
+  }
+
   private boolean jj_3R_2() {
     if (jj_scan_token(TERM)) return true;
     if (jj_scan_token(COLON)) return true;
@@ -1511,12 +1525,6 @@
     return false;
   }
 
-  private boolean jj_3R_3() {
-    if (jj_scan_token(STAR)) return true;
-    if (jj_scan_token(COLON)) return true;
-    return false;
-  }
-
   /** Generated Token Manager. */
   public QueryParserTokenManager token_source;
   /** Current token. */

Modified: lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj?rev=713225&r1=713224&r2=713225&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj Tue Nov 11 16:01:52
2008
@@ -45,6 +45,7 @@
 import org.apache.lucene.index.Term;
 import org.apache.lucene.search.BooleanClause;
 import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.ConstantScoreRangeQuery;
 import org.apache.lucene.search.FuzzyQuery;
 import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.lucene.search.MultiPhraseQuery;
@@ -777,11 +778,18 @@
    * @return new RangeQuery instance
    */
   protected Query newRangeQuery(String field, String part1, String part2, boolean inclusive)
{
-    RangeQuery query = new RangeQuery(field, part1, part2, inclusive, inclusive, rangeCollator);
+    RangeQuery query;  
+  
+    if (constantScoreRewrite) {
+      // TODO: remove in Lucene 3.0
+      query = new ConstantScoreRangeQuery(field, part1, part2, inclusive, inclusive, rangeCollator);
+    } else {
+      query = new RangeQuery(field, part1, part2, inclusive, inclusive, rangeCollator);
+    }
     query.setConstantScoreRewrite(constantScoreRewrite);
     return query;
   }
-
+  
   /**
    * Builds a new MatchAllDocsQuery instance
    * @return new MatchAllDocsQuery instance

Modified: lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParserTokenManager.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParserTokenManager.java?rev=713225&r1=713224&r2=713225&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParserTokenManager.java
(original)
+++ lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParserTokenManager.java
Tue Nov 11 16:01:52 2008
@@ -19,6 +19,7 @@
 import org.apache.lucene.index.Term;
 import org.apache.lucene.search.BooleanClause;
 import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.ConstantScoreRangeQuery;
 import org.apache.lucene.search.FuzzyQuery;
 import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.lucene.search.MultiPhraseQuery;



Mime
View raw message