lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sim...@apache.org
Subject svn commit: r1064761 - in /lucene/dev/branches/branch_3x/solr: ./ src/java/org/apache/solr/handler/component/QueryComponent.java
Date Fri, 28 Jan 2011 16:24:36 GMT
Author: simonw
Date: Fri Jan 28 16:24:36 2011
New Revision: 1064761

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

Modified:
    lucene/dev/branches/branch_3x/solr/   (props changed)
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/component/QueryComponent.java

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/component/QueryComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/component/QueryComponent.java?rev=1064761&r1=1064760&r2=1064761&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/component/QueryComponent.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/component/QueryComponent.java
Fri Jan 28 16:24:36 2011
@@ -90,7 +90,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) {
@@ -98,6 +97,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);



Mime
View raw message