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 cyang2010 <ys...@hotmail.com> on 2011/03/08 03:25:49 UTC

logical relation among filter queries

I wonder what is the logical relation among filter queries.  I can't find
much documentation on filter query.

for example,  i want to find all titles that is either PG-13 or R through
filter query.   The following query won't give me any result back.  So I
suppose by default it is intersection among each filter query result?

&fq=rating:PG-13&fq=rating:R&q=*:*


How do i change it to union to include value for each filter query result?

Thanks.






--
View this message in context: http://lucene.472066.n3.nabble.com/logical-relation-among-filter-queries-tp2649142p2649142.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: logical relation among filter queries

Posted by Erick Erickson <er...@gmail.com>.
Can't really answer that question in the abstract. About all you can
really do is monitor your caches (the admin stats page helps) and
note if/when you start getting cache evictions and adjust then.

I really wouldn't worry about this unless and until you start getting
query slowdowns, just go ahead and use combined filter queries
instead (i.e. fq=(A OR B OR C)....

Best
Erick

On Tue, Mar 8, 2011 at 12:15 PM, cyang2010 <ys...@hotmail.com> wrote:
> Erick,
>
> Thanks for reply.
>
> Is there anyway that i can instruct to combine seperate filter queries with
> UNION result, without creating the 3rd filter query cache as I described
> above?
>
> If not, shall I give up using filter query for such scenario (where i query
> the same field with multiple value using OR) and using normal solr query
> instead?  At least solr query cache is lighter weighted than filter query
> cache.
>
> What do you think?  Thanks,
>
>
> Carole
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/logical-relation-among-filter-queries-tp2649142p2651639.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: logical relation among filter queries

Posted by cyang2010 <ys...@hotmail.com>.
Erick,

Thanks for reply.

Is there anyway that i can instruct to combine seperate filter queries with
UNION result, without creating the 3rd filter query cache as I described
above?

If not, shall I give up using filter query for such scenario (where i query
the same field with multiple value using OR) and using normal solr query
instead?  At least solr query cache is lighter weighted than filter query
cache.  

What do you think?  Thanks,


Carole

--
View this message in context: http://lucene.472066.n3.nabble.com/logical-relation-among-filter-queries-tp2649142p2651639.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: logical relation among filter queries

Posted by Erick Erickson <er...@gmail.com>.
The filter queries are interpreted to be intersection. That is, each
fq clause is intersected with the result set. There's no way I know
of to combine separate filter queries with an "OR" operator.

Best
Erick

On Tue, Mar 8, 2011 at 2:59 AM, cyang2010 <ys...@hotmail.com> wrote:
> Right, i can combine that into one fq query.
>
> The only thing is that i want to reduce the cache size.
>
> I remember this is what i read from wiki.
>
> fq=rating:R         (filter query cache A)
> fq=rating:PG-13  (filter query cache B)
> fq=rating:(R O PG-13)  --  (It won't be able to leverage the filter query
> cache A and B above, instead it will create another whole new filter query
> cache C)
>
> fq=rating:R&fq=rating:PG-13  -- (Will be able to leverage filter query cache
> A and B)
>
>
> I will have a lot of queries with different combination of the values out of
> the same field, rating.   Therefore, i thought if the logical relation among
> filter query is OR, it will control the number of distinct cache to be
> distinct number of rating value.
>
>
> Does it matter?
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/logical-relation-among-filter-queries-tp2649142p2649904.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: logical relation among filter queries

Posted by cyang2010 <ys...@hotmail.com>.
Right, i can combine that into one fq query.  

The only thing is that i want to reduce the cache size.  

I remember this is what i read from wiki.  

fq=rating:R         (filter query cache A)
fq=rating:PG-13  (filter query cache B)
fq=rating:(R O PG-13)  --  (It won't be able to leverage the filter query
cache A and B above, instead it will create another whole new filter query
cache C)

fq=rating:R&fq=rating:PG-13  -- (Will be able to leverage filter query cache
A and B)


I will have a lot of queries with different combination of the values out of
the same field, rating.   Therefore, i thought if the logical relation among
filter query is OR, it will control the number of distinct cache to be
distinct number of rating value.  


Does it matter?

--
View this message in context: http://lucene.472066.n3.nabble.com/logical-relation-among-filter-queries-tp2649142p2649904.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: logical relation among filter queries

Posted by Jayendra Patil <ja...@gmail.com>.
you can use the boolean operators in the filter query.

e.g. fq=rating:(PG-13 OR R)

Regards,
Jayendra

On Mon, Mar 7, 2011 at 9:25 PM, cyang2010 <ys...@hotmail.com> wrote:
> I wonder what is the logical relation among filter queries.  I can't find
> much documentation on filter query.
>
> for example,  i want to find all titles that is either PG-13 or R through
> filter query.   The following query won't give me any result back.  So I
> suppose by default it is intersection among each filter query result?
>
> &fq=rating:PG-13&fq=rating:R&q=*:*
>
>
> How do i change it to union to include value for each filter query result?
>
> Thanks.
>
>
>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/logical-relation-among-filter-queries-tp2649142p2649142.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>