OR filtering...

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

OR filtering...

escher2k
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.
Reply | Threaded
Open this post in threaded view
|

Re: OR filtering...

Yonik Seeley-2
On 1/29/07, escher2k <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: OR filtering...

Mike Klaas
In reply to this post by escher2k
On 1/29/07, escher2k <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: OR filtering...

Erik Hatcher
In reply to this post by Yonik Seeley-2

On Jan 29, 2007, at 7:26 PM, Yonik Seeley wrote:

> On 1/29/07, escher2k <[hidden email]> 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