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 Antoine LE FLOC'H <le...@gmail.com> on 2011/12/01 16:01:58 UTC
&(fq=field1:val1 AND field2:val2) VS &fq=field1:val1&fq=field2:val2
and filterCache
Hello,
Is there any difference in the way things are stored in the filterCache if
I do
&(fq=field1:val1 AND field2:val2)
or
&fq=field1:val&fq=field2:val2
eventhough these are logically identical ? What get stored exactly ? Also
can you point me to where in the Solr source code this processing happens ?
Thank you.
Antoine.
Re: &(fq=field1:val1 AND field2:val2) VS &fq=field1:val1&fq=field2:val2
and filterCache
Posted by Tanguy Moal <ta...@gmail.com>.
Hello,
Quoting http://wiki.apache.org/solr/SolrCaching#filterCache :
> The filter cache stores the results of any filter queries ("fq"
> parameters) that Solr is explicitly asked to execute. (Each filter is
> executed and cached separately. When it's time to use them to limit
> the number of results returned by a query, this is done using set
> intersections.)
Finding what best suits your needs probably depends on how field1:val1
and field2:val2 vary all together, ie wether there exist a correlation
in issuing field2:val2 knowing that field1:val1 was issued (or the other
way)
Hope this helps ;-)
Tanguy
Le 01/12/2011 16:01, Antoine LE FLOC'H a écrit :
> Hello,
>
> Is there any difference in the way things are stored in the filterCache if
> I do
>
> &(fq=field1:val1 AND field2:val2)
> or
> &fq=field1:val&fq=field2:val2
>
> eventhough these are logically identical ? What get stored exactly ? Also
> can you point me to where in the Solr source code this processing happens ?
>
> Thank you.
>
> Antoine.
>
Re: &(fq=field1:val1 AND field2:val2) VS &fq=field1:val1&fq=field2:val2
and filterCache
Posted by Antoine LE FLOC'H <le...@gmail.com>.
Thank you for your answers.
Antoine.
On Fri, Dec 2, 2011 at 2:08 AM, Shawn Heisey <so...@elyograg.org> wrote:
> On 12/1/2011 8:01 AM, Antoine LE FLOC'H wrote:
>
>> Is there any difference in the way things are stored in the filterCache if
>> I do
>>
>> &(fq=field1:val1 AND field2:val2)
>> or
>> &fq=field1:val&fq=field2:val2
>>
>> eventhough these are logically identical ? What get stored exactly ? Also
>> can you point me to where in the Solr source code this processing happens
>> ?
>>
>
> Your first example would result in one entry in filterCache, probably for
> "+field1:val1 +field2:val2" which is what the parser ultimately reduces the
> query to. Your second example will result in two separate entries in
> filterCache.
>
> The second example takes more cache space, but it is also more reusable.
> If you started with a clean cache and sent "&fq=field2:val2&field3:val3"
> immediately after sending your second example, one of the filter queries
> would be satisfied from the cache, so Solr would use fewer resources on the
> query as a whole. If you sent your first example and then
> "&fq=(field2:val2 AND field3:val3)" there would be no speedup from the
> cache, because the new query wouldn't match the previous one at all.
>
> Thanks,
> Shawn
>
>
Re: &(fq=field1:val1 AND field2:val2) VS &fq=field1:val1&fq=field2:val2
and filterCache
Posted by Shawn Heisey <so...@elyograg.org>.
On 12/1/2011 8:01 AM, Antoine LE FLOC'H wrote:
> Is there any difference in the way things are stored in the filterCache if
> I do
>
> &(fq=field1:val1 AND field2:val2)
> or
> &fq=field1:val&fq=field2:val2
>
> eventhough these are logically identical ? What get stored exactly ? Also
> can you point me to where in the Solr source code this processing happens ?
Your first example would result in one entry in filterCache, probably
for "+field1:val1 +field2:val2" which is what the parser ultimately
reduces the query to. Your second example will result in two separate
entries in filterCache.
The second example takes more cache space, but it is also more
reusable. If you started with a clean cache and sent
"&fq=field2:val2&field3:val3" immediately after sending your second
example, one of the filter queries would be satisfied from the cache, so
Solr would use fewer resources on the query as a whole. If you sent
your first example and then "&fq=(field2:val2 AND field3:val3)" there
would be no speedup from the cache, because the new query wouldn't match
the previous one at all.
Thanks,
Shawn