FilterQuery and Ors

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

FilterQuery and Ors

Jamie Johnson
I'm looking for a way to do a filter query and Ors.  I've done a bit of
googling and found an open jira but nothing indicating this is possible.
I'm looking to do something like the search at
http://www.lucidimagination.com/search/?q=test
where you can do multi selects for the facets.  I've read about it at
http://wiki.apache.org/solr/SimpleFacetParameters#Multi-Select_Faceting_and_LocalParamsso
I have the tag/exclusion working but if I select two items from a
facet
group (say age from 1 to 10 and age from 10 to 20) I get nothing because
nothing meets both of those criteria.  I can obviously write something
custom to build an OR out of this but that seems less elegant.  Any guidance
would be appreciated
Reply | Threaded
Open this post in threaded view
|

Re: FilterQuery and Ors

Erick Erickson
try fq=age:[1 TO 10] OR age:[10 TO 20]

I'm pretty sure

fq=age:([1 TO 10] OR [10 TO 20])

will work too.

But you're right, multiple fq clauses are intersections, so specifying more
than one fq clause on the SAME field results in what you're seeing.

Best
Erick

On Wed, Jun 8, 2011 at 5:34 PM, Jamie Johnson <[hidden email]> wrote:

> I'm looking for a way to do a filter query and Ors.  I've done a bit of
> googling and found an open jira but nothing indicating this is possible.
> I'm looking to do something like the search at
> http://www.lucidimagination.com/search/?q=test
> where you can do multi selects for the facets.  I've read about it at
> http://wiki.apache.org/solr/SimpleFacetParameters#Multi-Select_Faceting_and_LocalParamsso
> I have the tag/exclusion working but if I select two items from a
> facet
> group (say age from 1 to 10 and age from 10 to 20) I get nothing because
> nothing meets both of those criteria.  I can obviously write something
> custom to build an OR out of this but that seems less elegant.  Any guidance
> would be appreciated
>