You're using query and filter query backwards - the query is what you are looking for (the OR), while the filter query is the constraint on the query - the drill down.

-- Jack Krupansky

-----Original Message----- From: Michael Jones
Sent: Thursday, January 10, 2013 7:38 AM
To: solr-user@lucene.apache.org
Subject: Re: OR query

Thanks, I've tried doing

<lst name="params">
<str name="wt">xml</str>
<str name="fq">
(constituencies:(ian paisley) OR label:(ian paisley) OR office:(ian
paisley))
</str>
<str name="q">name_long:"paisley, ian"</str>
</lst>
</lst>
<result name="response" numFound="0" start="0"/>

and

<str name="fq">+ian +paisley "paisley, ian"</str>
<str name="q">name_long:"paisley, ian"</str>

But neither return any results


On Thu, Jan 10, 2013 at 11:53 AM, Jack Krupansky <j...@basetechnology.com>wrote:

Use filter queries to filter or drill down:

http://wiki.apache.org/solr/**CommonQueryParameters#fq<http://wiki.apache.org/solr/CommonQueryParameters#fq>

Also consider using dismax/edismax queries, which are designed to match on
any of multiple fields.

Also be careful to put a space between each left parenthesis and field
name since there is a known bug that causes such queries to fail.

-- Jack Krupansky

-----Original Message----- From: Michael Jones
Sent: Thursday, January 10, 2013 6:24 AM
To: solr-user@lucene.apache.org
Subject: OR query


Hi,

I have a query that searches through every field to find the text 'london'

(constituencies:(london) OR label:(london) OR name:(london) OR
office:(london))

Which works fine, but when I want to filter my results. Say I want to
filter down to constituencies that exactly match 'london', but also search
the rest of the fields to make sure that the keyword still matches
elsewhere

(label:(london) OR name:(london) OR office:(london)) AND
(constituencies:"london")

Sometimes I get zero results because label, name and office don't have the
keyword 'london', but I know constituencies does, so results should be > 0.
But if try:

(constituencies:(london) OR name:(london) OR office:(london)) AND
(label:"london")

returns results because constituencies is in one of the OR queries.

Is there a way to say if none of the OR quires bring back a result at least
search the AND?

Thanks


Reply via email to