lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Klaas (JIRA)" <j...@apache.org>
Subject [jira] Commented: (SOLR-80) negative filter queries
Date Tue, 23 Jan 2007 01:39:49 GMT

    [ https://issues.apache.org/jira/browse/SOLR-80?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466612
] 

Mike Klaas commented on SOLR-80:
--------------------------------

I think this is due to the last line of this fragment of the patch:

   protected DocSet getDocSet(List<Query> queries) throws IOException {
+    if (queries==null) return null;
+    if (queries.size()==1) return getDocSet(queries.get(0));
     DocSet answer=null;
-    if (queries==null) return null;
-    for (Query q : queries) {
-      if (answer==null) {
-        answer = getDocSet(q);
+
+    boolean[] neg = new boolean[queries.size()];
+    DocSet[] sets = new DocSet[queries.size()];
+
+    int smallestIndex = -1;
+    int smallestCount = Integer.MAX_VALUE;
+    for (int i=0; i<sets.length; i++) {
+      Query q = queries.get(i);
+      Query posQuery = QueryUtils.getAbs(q);
+      sets[i] = getPositiveDocSet(posQuery);

getPositiveDocSet() caches all docsets returned, so both the query part and the filter part
would be cached in the filterCache.

> negative filter queries
> -----------------------
>
>                 Key: SOLR-80
>                 URL: https://issues.apache.org/jira/browse/SOLR-80
>             Project: Solr
>          Issue Type: New Feature
>          Components: search
>            Reporter: Yonik Seeley
>         Attachments: negative_filters.patch, negative_filters.patch
>
>
> There is a need for negative filter queries to avoid long filter generation times and
large caching requirements.
> Currently, if someone wants to filter out a small number of documents, they must specify
the complete set of documents to express those negative conditions against.  
> q=foo&fq=id:[* TO *] -id:101
> In this example, to filter out a single document, the complete set of documents (minus
one) is generated, and a large bitset is cached.  You could also add the restriction to the
main query, but that doesn't work with the dismax handler which doesn't have a facility for
this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message