You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Ertio Lew <er...@gmail.com> on 2013/10/06 11:22:54 UTC

Does the queryResultCache, contain all the results returned by main query or after filtering out

Does the queryResultCache, contain all the results returned by main query(q
param) or it contains results prepared after all filter queries ?

Re: Does the queryResultCache, contain all the results returned by main query or after filtering out

Posted by Erick Erickson <er...@gmail.com>.
No, the queryResultCache contains the top N for the query, _including_
the filters.
The idea is that you should be able to get the next page of results
without going
to any searching code. You couldn't do this if in the scenario you describe.

If your filters are truly unique, you'll gain a little bit of
performance by specifying
the local param for your fq clause of: {!cache=false}, that will just
bypass adding
it to the filterCache.

Try thinking about it backwards. Especially if you don't care about
scoring, say you
are sorting by distance. Don't put the terms in the main query, put
everything in in
fq clauses so your query becomes something like:
q=*:*&fq=field:term AND field:term&fq={!cache=false}unique
clause1&fq={!cache=false}unique clause2

The beauty of his is that you can assign "weight" to the cache=false clauses so
they will only be calculated for docs that make it through your
lower-cost fq clauses.
And the main query.
See: http://solr.pl/en/2012/03/05/use-of-cachefalse-and-cost-parameters/

Best
Erick

On Sun, Oct 6, 2013 at 9:56 AM, Ertio Lew <er...@gmail.com> wrote:
> Background: I need to find items matching keywords provided by user,
> filtered by availability within certain radius from his location & filtered
> by other user specific params.
>
> So I think this may be very relevant for me because my filter queries may
> be very unique all the time(since I am filtering by geospatial search,
> people find items nearest to them). Also some additional user specific
> filters. So filter queries will always be unique, but the people may use
> common keywords to lookup, so main query (q param) may be common most
> times. So if queryResultCache contain all the results returned by main
> query(q param) , as before filtering then only I think this queryResultCache
> may be helpful for me. Isn't it ?
>
>
> On Sun, Oct 6, 2013 at 7:13 PM, Erick Erickson <er...@gmail.com>wrote:
>
>> First, why is it important to you? General background or a specific
>> problem you're trying to address?
>>
>> But to answer, no. The queryResultCache contains the top N
>> ids for the query. You control N by setting <queryResultWindowSize>
>> in solrconfig.xml. It's often set to 2x the usual "rows" parameter
>> on the theory that people rarely page past the second page.
>>
>> Best,
>> Erick
>>
>> On Sun, Oct 6, 2013 at 5:22 AM, Ertio Lew <er...@gmail.com> wrote:
>> > Does the queryResultCache, contain all the results returned by main
>> query(q
>> > param) or it contains results prepared after all filter queries ?
>>

Re: Does the queryResultCache, contain all the results returned by main query or after filtering out

Posted by Ertio Lew <er...@gmail.com>.
Background: I need to find items matching keywords provided by user,
filtered by availability within certain radius from his location & filtered
by other user specific params.

So I think this may be very relevant for me because my filter queries may
be very unique all the time(since I am filtering by geospatial search,
people find items nearest to them). Also some additional user specific
filters. So filter queries will always be unique, but the people may use
common keywords to lookup, so main query (q param) may be common most
times. So if queryResultCache contain all the results returned by main
query(q param) , as before filtering then only I think this queryResultCache
may be helpful for me. Isn't it ?


On Sun, Oct 6, 2013 at 7:13 PM, Erick Erickson <er...@gmail.com>wrote:

> First, why is it important to you? General background or a specific
> problem you're trying to address?
>
> But to answer, no. The queryResultCache contains the top N
> ids for the query. You control N by setting <queryResultWindowSize>
> in solrconfig.xml. It's often set to 2x the usual "rows" parameter
> on the theory that people rarely page past the second page.
>
> Best,
> Erick
>
> On Sun, Oct 6, 2013 at 5:22 AM, Ertio Lew <er...@gmail.com> wrote:
> > Does the queryResultCache, contain all the results returned by main
> query(q
> > param) or it contains results prepared after all filter queries ?
>

Re: Does the queryResultCache, contain all the results returned by main query or after filtering out

Posted by Erick Erickson <er...@gmail.com>.
First, why is it important to you? General background or a specific
problem you're trying to address?

But to answer, no. The queryResultCache contains the top N
ids for the query. You control N by setting <queryResultWindowSize>
in solrconfig.xml. It's often set to 2x the usual "rows" parameter
on the theory that people rarely page past the second page.

Best,
Erick

On Sun, Oct 6, 2013 at 5:22 AM, Ertio Lew <er...@gmail.com> wrote:
> Does the queryResultCache, contain all the results returned by main query(q
> param) or it contains results prepared after all filter queries ?