From a7a9be923ec56c2918294da427f7f467c9a82d7e Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Fri, 28 Jan 2011 15:25:33 +0000 Subject: [PATCH] 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 --- .../org/apache/solr/handler/component/QueryComponent.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/solr/src/java/org/apache/solr/handler/component/QueryComponent.java b/solr/src/java/org/apache/solr/handler/component/QueryComponent.java index f98d65493ca..10049937917 100644 --- a/solr/src/java/org/apache/solr/handler/component/QueryComponent.java +++ b/solr/src/java/org/apache/solr/handler/component/QueryComponent.java @@ -107,7 +107,6 @@ public class QueryComponent extends SearchComponent List filters = rb.getFilters(); if (filters==null) { filters = new ArrayList(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);