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 escher2k <es...@yahoo.com> on 2007/01/30 01:12:36 UTC

OR filtering...

Hi,
  I have a question about the syntax for doing an OR filter in my URL. How
do I specify
where ((fq=colA[10 TO 20]) AND (fq=state:USA OR fq=country:USA) ? Basically,
I am
doing a search for a keyword across certain fields and I want to filter the
result set. 
The user can input city/state/country in a text field on the UI - hence the
OR.

Thank you.
-- 
View this message in context: http://www.nabble.com/OR-filtering...-tf3139252.html#a8701026
Sent from the Solr - User mailing list archive at Nabble.com.


Re: OR filtering...

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jan 29, 2007, at 7:26 PM, Yonik Seeley wrote:

> On 1/29/07, escher2k <es...@yahoo.com> wrote:
>>   I have a question about the syntax for doing an OR filter in my  
>> URL. How
>> do I specify
>> where ((fq=colA[10 TO 20]) AND (fq=state:USA OR fq=country:USA) ?  
>> Basically,
>> I am
>> doing a search for a keyword across certain fields and I want to  
>> filter the
>> result set.
>> The user can input city/state/country in a text field on the UI -  
>> hence the
>> OR.
>
> A single fq with the OR clauses in lucene query parser syntax  
> should work.
>
> &fq=colA[10 TO 20]&fq=state:USA OR country:USA

Note that this should be fq=colA:[10 TO 20], etc. (note the colon  
after  "colA").

(or is another of those "get with it Erik, QueryParser handles this  
already" sorta things? ;)

	Erik


Re: OR filtering...

Posted by Yonik Seeley <yo...@apache.org>.
On 1/29/07, escher2k <es...@yahoo.com> wrote:
>   I have a question about the syntax for doing an OR filter in my URL. How
> do I specify
> where ((fq=colA[10 TO 20]) AND (fq=state:USA OR fq=country:USA) ? Basically,
> I am
> doing a search for a keyword across certain fields and I want to filter the
> result set.
> The user can input city/state/country in a text field on the UI - hence the
> OR.

A single fq with the OR clauses in lucene query parser syntax should work.

&fq=colA[10 TO 20]&fq=state:USA OR country:USA

-Yonik

Re: OR filtering...

Posted by Mike Klaas <mi...@gmail.com>.
On 1/29/07, escher2k <es...@yahoo.com> wrote:
>
> Hi,
>   I have a question about the syntax for doing an OR filter in my URL. How
> do I specify
> where ((fq=colA[10 TO 20]) AND (fq=state:USA OR fq=country:USA) ? Basically,
> I am
> doing a search for a keyword across certain fields and I want to filter the
> result set.
> The user can input city/state/country in a text field on the UI - hence the
> OR.

Multiple fq's are AND'd together, but a single fq can contain
arbitrary lucene query syntax.

So
fq=colA[10 TO 20] AND (state:USA OR country:USA)
or
fq=colA[10 TO 20])&fq=state:USA OR country:USA

The different lies in the caching behaviour.
-Mike