diff --git a/src/java/org/apache/lucene/queryParser/QueryParserTokenManager.java b/src/java/org/apache/lucene/queryParser/QueryParserTokenManager.java index 22de31f50bc..e9f73c34cd4 100644 --- a/src/java/org/apache/lucene/queryParser/QueryParserTokenManager.java +++ b/src/java/org/apache/lucene/queryParser/QueryParserTokenManager.java @@ -8,6 +8,7 @@ import org.apache.lucene.index.Term; import org.apache.lucene.analysis.*; import org.apache.lucene.document.*; import org.apache.lucene.search.*; +import org.apache.lucene.util.Parameter; public class QueryParserTokenManager implements QueryParserConstants { diff --git a/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.java b/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.java index 6030da5bc00..36c0a064e5d 100644 --- a/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.java +++ b/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.java @@ -428,11 +428,31 @@ public class PrecedenceQueryParser implements PrecedenceQueryParserConstants { * @exception ParseException throw in overridden method to disallow */ protected Query getBooleanQuery(Vector clauses) throws ParseException + { + return getBooleanQuery(clauses, false); + } + + /** + * Factory method for generating query, given a set of clauses. + * By default creates a boolean query composed of clauses passed in. + * + * Can be overridden by extending classes, to modify query being + * returned. + * + * @param clauses Vector that contains {@link BooleanClause} instances + * to join. + * @param disableCoord true if coord scoring should be disabled. + * + * @return Resulting {@link Query} object. + * @exception ParseException throw in overridden method to disallow + */ + protected Query getBooleanQuery(Vector clauses, boolean disableCoord) + throws ParseException { if (clauses == null || clauses.size() == 0) return null; - BooleanQuery query = new BooleanQuery(); + BooleanQuery query = new BooleanQuery(disableCoord); for (int i = 0; i < clauses.size(); i++) { query.add((BooleanClause)clauses.elementAt(i)); } diff --git a/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.jj b/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.jj index 7ec997ad6c5..08132b60dfd 100644 --- a/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.jj +++ b/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.jj @@ -451,8 +451,10 @@ public class PrecedenceQueryParser { * @exception ParseException throw in overridden method to disallow */ protected Query getBooleanQuery(Vector clauses) throws ParseException - getBooleanQuery(clauses, false); + { + return getBooleanQuery(clauses, false); } + /** * Factory method for generating query, given a set of clauses. * By default creates a boolean query composed of clauses passed in.