lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Rochkind <>
Subject Re: filter cache and negative filter query
Date Tue, 17 May 2011 22:21:04 GMT
1. I don't think Solr will re-use the filter cache in that situation, 
although I'm not sure. But I comment anyway because, not what you asked 
but something else that will trip you up with your example:

2. In fact, a pure-negative query like that doesn't work _at all_ in the 
default solr/lucene query parser used for 'fq', at least in Solr 1.4.1. 
Not sure if it's been improved in 3.1, but I don't think so.  It will 
always return 0 hits, the solr/lucene query parser can't generate a 
proper lucene query from a pure negative query like that.

To get around this, you can find a variation the query that means the 
same thing but isn't that form. Here's a really ugly one I use, with a 
nested dismax -- dismax ALSO has trouble with pure negatives, although I 
think maybe edismax can handle em? But this weird as heck combo works, 
maybe there's a better way.

NOT _query_:"{!dismax qf=something}history"

And to come around full circle, I have NO idea what effect nested 
queries have on the filter cache. I think that STILL won't re-use the 
filter cache.... but I wonder if it'll re-use the _query_ cache for 
"history"?  I forget even more how the query cache works though.

On 5/17/2011 6:07 PM, Burton-West, Tom wrote:
> If I have a query with a filter query such as : " q=art&fq=history" and then run
a second query  "q=art&fq=-history", will Solr realize that it can use the cached results
of the previous filter query "history"  (in the filter cache) or will it not realize this
and have to actually do a second filter query against the index  for "not history"?
> Tom

View raw message