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 Tim Vaillancourt <ti...@elementspace.com> on 2013/10/14 22:22:01 UTC

fq caching question

Hey guys,

Sorry for such a simple question, but I am curious as to the differences 
in caching between a "combined" filter query, and many separate filter 
queries.

Here are 2 example queries, one with combined fq, one separate:

1) "/select?q=*:*&fq=type:bid&fq=user_id:3"
2) "/select?q=*:*&fq=(type:bid%20AND%20user_id:3)"

For query #1: am I correct that the first query will keep 2 independent 
entries in the filterCache for type:bid and user_id:3?\
For query #2: is it correct that the 2nd query will keep 1 entry in the 
filterCache that satisfies all conditions?

Lastly, is it a fair statement that under general query patterns, many 
separate filter queries are more-cacheable than 1 combined one? Eg, if I 
performed query #2 (in the filterCache) and then changed the user_id, 
nothing about my new query is cache able, correct (but if I used 2 
separate filter queries than 1 of 2 is still cached)?

Cheers,

Tim Vaillancourt

Re: fq caching question

Posted by Erick Erickson <er...@gmail.com>.
Tim:

Do watch out for using NOW in filter queries, see:
http://searchhub.org/2012/02/23/date-math-now-and-filter-queries/

Best,
Erick


On Tue, Oct 15, 2013 at 5:36 AM, Tim Vaillancourt <ti...@elementspace.com>wrote:

> Thanks Koji!
>
> Cheers,
>
> Tim
>
>
> On 14/10/13 03:56 PM, Koji Sekiguchi wrote:
>
>> Hi Tim,
>>
>> (13/10/15 5:22), Tim Vaillancourt wrote:
>>
>>> Hey guys,
>>>
>>> Sorry for such a simple question, but I am curious as to the differences
>>> in caching between a
>>> "combined" filter query, and many separate filter queries.
>>>
>>> Here are 2 example queries, one with combined fq, one separate:
>>>
>>> 1) "/select?q=*:*&fq=type:bid&fq=**user_id:3"
>>> 2) "/select?q=*:*&fq=(type:bid%**20AND%20user_id:3)"
>>>
>>> For query #1: am I correct that the first query will keep 2 independent
>>> entries in the filterCache
>>> for type:bid and user_id:3?\
>>>
>>
>> Correct.
>>
>>  For query #2: is it correct that the 2nd query will keep 1 entry in the
>>> filterCache that satisfies
>>> all conditions?
>>>
>>
>> Correct.
>>
>>  Lastly, is it a fair statement that under general query patterns, many
>>> separate filter queries are
>>> more-cacheable than 1 combined one? Eg, if I performed query #2 (in the
>>> filterCache) and then
>>> changed the user_id, nothing about my new query is cache able, correct
>>> (but if I used 2 separate
>>> filter queries than 1 of 2 is still cached)?
>>>
>>
>> Yes, it is.
>>
>> koji
>>
>

Re: fq caching question

Posted by Tim Vaillancourt <ti...@elementspace.com>.
Thanks Koji!

Cheers,

Tim

On 14/10/13 03:56 PM, Koji Sekiguchi wrote:
> Hi Tim,
>
> (13/10/15 5:22), Tim Vaillancourt wrote:
>> Hey guys,
>>
>> Sorry for such a simple question, but I am curious as to the 
>> differences in caching between a
>> "combined" filter query, and many separate filter queries.
>>
>> Here are 2 example queries, one with combined fq, one separate:
>>
>> 1) "/select?q=*:*&fq=type:bid&fq=user_id:3"
>> 2) "/select?q=*:*&fq=(type:bid%20AND%20user_id:3)"
>>
>> For query #1: am I correct that the first query will keep 2 
>> independent entries in the filterCache
>> for type:bid and user_id:3?\
>
> Correct.
>
>> For query #2: is it correct that the 2nd query will keep 1 entry in 
>> the filterCache that satisfies
>> all conditions?
>
> Correct.
>
>> Lastly, is it a fair statement that under general query patterns, 
>> many separate filter queries are
>> more-cacheable than 1 combined one? Eg, if I performed query #2 (in 
>> the filterCache) and then
>> changed the user_id, nothing about my new query is cache able, 
>> correct (but if I used 2 separate
>> filter queries than 1 of 2 is still cached)?
>
> Yes, it is.
>
> koji

Re: fq caching question

Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
Hi Tim,

(13/10/15 5:22), Tim Vaillancourt wrote:
> Hey guys,
>
> Sorry for such a simple question, but I am curious as to the differences in caching between a
> "combined" filter query, and many separate filter queries.
>
> Here are 2 example queries, one with combined fq, one separate:
>
> 1) "/select?q=*:*&fq=type:bid&fq=user_id:3"
> 2) "/select?q=*:*&fq=(type:bid%20AND%20user_id:3)"
>
> For query #1: am I correct that the first query will keep 2 independent entries in the filterCache
> for type:bid and user_id:3?\

Correct.

> For query #2: is it correct that the 2nd query will keep 1 entry in the filterCache that satisfies
> all conditions?

Correct.

> Lastly, is it a fair statement that under general query patterns, many separate filter queries are
> more-cacheable than 1 combined one? Eg, if I performed query #2 (in the filterCache) and then
> changed the user_id, nothing about my new query is cache able, correct (but if I used 2 separate
> filter queries than 1 of 2 is still cached)?

Yes, it is.

koji
-- 
http://soleami.com/blog/automatically-acquiring-synonym-knowledge-from-wikipedia.html