Only create a Filter list if there is a non-empty fq parameter

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1064730 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Willnauer 2011-01-28 15:25:33 +00:00
parent 4f1fe2b66d
commit a7a9be923e
1 changed files with 6 additions and 1 deletions

View File

@ -107,7 +107,6 @@ public class QueryComponent extends SearchComponent
List<Query> filters = rb.getFilters();
if (filters==null) {
filters = new ArrayList<Query>(fqs.length);
rb.setFilters( filters );
}
for (String fq : fqs) {
if (fq != null && fq.trim().length()!=0) {
@ -115,6 +114,12 @@ public class QueryComponent extends SearchComponent
filters.add(fqp.getQuery());
}
}
// only set the filters if they are not empty otherwise
// fq=&someotherParam= will trigger all docs filter for every request
// if filter cache is disabled
if (!filters.isEmpty()) {
rb.setFilters( filters );
}
}
} catch (ParseException e) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);