mirror of https://github.com/apache/lucene.git
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
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@713225 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4596360907
commit
9d8c882385
|
@ -21,6 +21,7 @@ import org.apache.lucene.document.DateTools;
|
|||
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 @@ public class QueryParser implements QueryParserConstants {
|
|||
* @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 @@ public class QueryParser implements QueryParserConstants {
|
|||
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 @@ public class QueryParser implements QueryParserConstants {
|
|||
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. */
|
||||
|
|
|
@ -45,6 +45,7 @@ import org.apache.lucene.document.DateTools;
|
|||
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 @@ public class QueryParser {
|
|||
* @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
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.apache.lucene.document.DateTools;
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue