Use filter queries to filter or drill down:

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