lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <s...@elyograg.org>
Subject Re: Using fq as OR
Date Wed, 21 May 2014 15:41:51 GMT
On 5/21/2014 9:26 AM, johnmunir@aol.com wrote:
> Currently, I'm building my search as follows:
>
>
>     q=(search string ...) AND (type:type_a OR type:type_b OR type:type_c OR ...)
>
>
> Which means anything I search for will be AND'ed to be in either fields that have "type_a",
"type_b", "type_c", etc.  (I have defaultOperator set to "AND")
>
>
> Now, I need to use "fq" so I'm not sure how to build my search string to get the same
result!!
>
>
> I have tried the following:
>
>
>     q=search string ...&fq=type:type_a&fq=type:type_b&fq=type:type_c&...
>
>
> But this isn't the same because each additional "fq" is now being treated as AND (keep
in mind, I have defaultOperator set to "AND" and I cannot change that).
>
>
> I have tried the following:
>
>
>     q=search string ...&fq=type:(type_a OR type_b OR type_c OR ...)
>
>
> But the result I get back is not the same.

If you are using the standard (lucene) query parser for your queries,
then fq should behave exactly the same.  If you are using a different
query parser (edismax, for example) then fq may not behave the same,
because it will use the lucene query parser.

With the standard query parser, if your original query looks like the
following:

q=(query) AND (filter)

The query below should produce exactly the same results -- although if
you are using the default relevance sort, the *order* is likely to be
different, because filter queries do not affect the document scores, but
everything in the q parameter does.

q=(query)&fq=(filter)

Thanks,
Shawn


Mime
View raw message