lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r791406 - in /lucene/java/trunk/src/java/org/apache/lucene: queryParser/ search/
Date Mon, 06 Jul 2009 07:58:29 GMT
Author: uschindler
Date: Mon Jul  6 07:58:28 2009
New Revision: 791406

URL: http://svn.apache.org/viewvc?rev=791406&view=rev
Log:
LUCENE-1713: Some minor fixes and additions to JavaDocs. ConstantScoreRangeQuery is fixed
to this mode now.

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
    lucene/java/trunk/src/java/org/apache/lucene/search/ConstantScoreRangeQuery.java
    lucene/java/trunk/src/java/org/apache/lucene/search/RangeQuery.java
    lucene/java/trunk/src/java/org/apache/lucene/search/TermRangeFilter.java
    lucene/java/trunk/src/java/org/apache/lucene/search/TermRangeQuery.java
    lucene/java/trunk/src/java/org/apache/lucene/search/TermRangeTermEnum.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=791406&r1=791405&r2=791406&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 Mon Jul  6 07:58:28
2009
@@ -24,7 +24,6 @@
 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;
@@ -71,7 +70,7 @@
  * </p>
  *
  * <p>
- * In {@link RangeQuery}s, QueryParser tries to detect date values, e.g.
+ * In {@link TermRangeQuery}s, QueryParser tries to detect date values, e.g.
  * <tt>date:[6/1/2005 TO 6/4/2005]</tt> produces a range query that searches
  * for "date" fields between 2005-06-01 and 2005-06-04. Note that the format
  * of the accepted input depends on {@link #setLocale(Locale) the locale}.
@@ -1626,6 +1625,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;
@@ -1642,12 +1647,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=791406&r1=791405&r2=791406&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 Mon Jul  6 07:58:28
2009
@@ -48,7 +48,6 @@
 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;
@@ -95,7 +94,7 @@
  * </p>
  *
  * <p>
- * In {@link RangeQuery}s, QueryParser tries to detect date values, e.g.
+ * In {@link TermRangeQuery}s, QueryParser tries to detect date values, e.g.
  * <tt>date:[6/1/2005 TO 6/4/2005]</tt> produces a range query that searches
  * for "date" fields between 2005-06-01 and 2005-06-04. Note that the format
  * of the accepted input depends on {@link #setLocale(Locale) the locale}.

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=791406&r1=791405&r2=791406&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
Mon Jul  6 07:58:28 2009
@@ -22,7 +22,6 @@
 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;

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/ConstantScoreRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/ConstantScoreRangeQuery.java?rev=791406&r1=791405&r2=791406&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/ConstantScoreRangeQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/ConstantScoreRangeQuery.java Mon Jul
 6 07:58:28 2009
@@ -21,13 +21,17 @@
 
 /**
  * A range query that returns a constant score equal to its boost for
- * all documents in the range.
- * <p>
- * It does not have an upper bound on the number of clauses covered in the range.
- * <p>
- * If an endpoint is null, it is said to be "open".
- * Either or both endpoints may be open.  Open endpoints may not be exclusive
- * (you can't select all but the first or last term without explicitly specifying the term
to exclude.)
+ * all documents in the exclusive range of terms.
+ *
+ * <p>It does not have an upper bound on the number of clauses covered in the range.
+ *
+ * <p>This query matches the documents looking for terms that fall into the
+ * supplied range according to {@link String#compareTo(String)}. It is not intended
+ * for numerical ranges, use {@link NumericRangeQuery} instead.
+ *
+ * <p>This query is in
+ * {@linkplain MultiTermQuery#setConstantScoreRewrite(boolean) constant score rewrite mode}.
+ * If you want to change this, use the new {@link TermRangeQuery} instead.
  *
  * @deprecated Use {@link TermRangeQuery} for term ranges or
  * {@link NumericRangeQuery} for numeric ranges instead.
@@ -40,14 +44,14 @@
   public ConstantScoreRangeQuery(String fieldName, String lowerVal, String upperVal, boolean
includeLower, boolean includeUpper)
   {
     super(fieldName, lowerVal, upperVal, includeLower, includeUpper);
-    setConstantScoreRewrite(true);
+    this.constantScoreRewrite = true;
   }
 
   public ConstantScoreRangeQuery(String fieldName, String lowerVal,
                                  String upperVal, boolean includeLower,
                                  boolean includeUpper, Collator collator) {
     super(fieldName, lowerVal, upperVal, includeLower, includeUpper, collator);
-    setConstantScoreRewrite(true);
+    this.constantScoreRewrite = true;
   }
 
   public String getLowerVal() {
@@ -57,4 +61,10 @@
   public String getUpperVal() {
     return getUpperTerm();
   }
+
+  /** Changes of mode are not supported by this class (fixed to constant score rewrite mode)
*/
+  public void setConstantScoreRewrite(boolean constantScoreRewrite) {
+    if (!constantScoreRewrite)
+      throw new UnsupportedOperationException("Use TermRangeQuery instead to enable boolean
query rewrite.");
+  }
 }

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/RangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/RangeQuery.java?rev=791406&r1=791405&r2=791406&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/RangeQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/RangeQuery.java Mon Jul  6 07:58:28
2009
@@ -27,11 +27,12 @@
  * A Query that matches documents within an exclusive range of terms.
  *
  * <p>This query matches the documents looking for terms that fall into the
- * supplied range according to {@link String#compareTo(String)}. It is not intended
+ * supplied range according to {@link Term#compareTo(Term)}. It is not intended
  * for numerical ranges, use {@link NumericRangeQuery} instead.
  *
- * <p>See {@link MultiTermQuery#setConstantScoreRewrite} for the tradeoffs between
- * enabling and disabling constantScoreRewrite mode.
+ * <p>This query is in
+ * {@linkplain MultiTermQuery#setConstantScoreRewrite(boolean) boolean query rewrite mode}.
+ * If you want to change this, use the new {@link TermRangeQuery} instead.
  *
  * @deprecated Use {@link TermRangeQuery} for term ranges or
  * {@link NumericRangeQuery} for numeric ranges instead.

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/TermRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/TermRangeFilter.java?rev=791406&r1=791405&r2=791406&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/TermRangeFilter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/TermRangeFilter.java Mon Jul  6 07:58:28
2009
@@ -29,6 +29,7 @@
  *
  * <p>If you construct a large number of range filters with different ranges but on
the 
  * same field, {@link FieldCacheRangeFilter} may have significantly better performance. 
+ * @since 2.9
  */
 public class TermRangeFilter extends MultiTermQueryWrapperFilter {
     

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/TermRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/TermRangeQuery.java?rev=791406&r1=791405&r2=791406&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/TermRangeQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/TermRangeQuery.java Mon Jul  6 07:58:28
2009
@@ -34,6 +34,7 @@
  * <p>This query is in constant score mode per default.
  * See {@link MultiTermQuery#setConstantScoreRewrite} for the tradeoffs between
  * enabling and disabling constantScoreRewrite mode.
+ * @since 2.9
  */
 
 public class TermRangeQuery extends MultiTermQuery {
@@ -109,7 +110,7 @@
     this.includeLower = includeLower;
     this.includeUpper = includeUpper;
     this.collator = collator;
-    setConstantScoreRewrite(true);
+    this.constantScoreRewrite = true;
   }
 
   /** Returns the field name for this query */

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/TermRangeTermEnum.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/TermRangeTermEnum.java?rev=791406&r1=791405&r2=791406&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/TermRangeTermEnum.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/TermRangeTermEnum.java Mon Jul  6
07:58:28 2009
@@ -29,6 +29,7 @@
  * <p>
  * Term enumerations are always ordered by Term.compareTo().  Each term in
  * the enumeration is greater than all that precede it.
+ * @since 2.9
  */
 public class TermRangeTermEnum extends FilteredTermEnum {
 



Mime
View raw message