handle null query returning from query parsers properly

now that we support "null" queries, for example, when parsing a query and its lenient, make sure to handle it where applicable
This commit is contained in:
Shay Banon 2012-08-09 13:50:10 +02:00
parent e43dd4687e
commit a1ab48c804
4 changed files with 12 additions and 0 deletions

View File

@ -166,6 +166,9 @@ public class FieldQueryParser implements QueryParser {
try {
query = queryParser.parse(qpSettings.queryString());
if (query == null) {
return null;
}
query.setBoost(qpSettings.boost());
query = optimizeQuery(fixNegativeQueryIfNeeded(query));
if (query instanceof BooleanQuery) {

View File

@ -139,6 +139,9 @@ public class MatchQueryParser implements QueryParser {
}
Query query = matchQuery.parse(type, fieldName, text);
if (query == null) {
return null;
}
if (query instanceof BooleanQuery) {
Queries.applyMinimumShouldMatch((BooleanQuery) query, minimumShouldMatch);

View File

@ -169,6 +169,9 @@ public class MultiMatchQueryParser implements QueryParser {
}
Query query = multiMatchQuery.parse(type, fieldNames, text);
if (query == null) {
return null;
}
if (query instanceof BooleanQuery) {
Queries.applyMinimumShouldMatch((BooleanQuery) query, minimumShouldMatch);

View File

@ -210,6 +210,9 @@ public class QueryStringQueryParser implements QueryParser {
try {
query = queryParser.parse(qpSettings.queryString());
if (query == null) {
return null;
}
query.setBoost(qpSettings.boost());
query = optimizeQuery(fixNegativeQueryIfNeeded(query));
if (query instanceof BooleanQuery) {