You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2011/01/28 16:25:33 UTC

svn commit: r1064730 - /lucene/dev/trunk/solr/src/java/org/apache/solr/handler/component/QueryComponent.java

Author: simonw
Date: Fri Jan 28 15:25:33 2011
New Revision: 1064730

URL: http://svn.apache.org/viewvc?rev=1064730&view=rev
Log:
Only create a Filter list if there is a non-empty fq parameter 

Modified:
    lucene/dev/trunk/solr/src/java/org/apache/solr/handler/component/QueryComponent.java

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/handler/component/QueryComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/handler/component/QueryComponent.java?rev=1064730&r1=1064729&r2=1064730&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/handler/component/QueryComponent.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/handler/component/QueryComponent.java Fri Jan 28 15:25:33 2011
@@ -107,7 +107,6 @@ public class QueryComponent extends Sear
         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 Sear
             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);