Your query is really the same as

mfrid:18678 -categoryid:3876021

Which means select all documents with that mfrid value and then exclude from that set all documents that have the specified categoryid.

Maybe what you wanted is

mfrid:18678 OR (*:* -categoryid:3876021)

or

q=(*:* !categoryid:3876021) OR mfrid:18678

Which means take all documents and those with the specified categoryid and THEN union that with all docs having the specified mfrid.

-- Jack Krupansky

-----Original Message----- From: Steve
Sent: Wednesday, October 03, 2012 4:10 PM
To: solr-user@lucene.apache.org
Subject: OR query with multiple fields

If I search for

q=!categoryid:3876021, solr correctly tells me there are two million plus hits.

If I search for

q=mfrid:18678, solr tell me there are 50,314 hits

I want to combine those two results, so I try

q=!categoryid:3876021 OR mfrid:18678

I would have expected two million plus results, instead, I get 50,314.

Is there a way to do a union of results from searching two different fields?

Curiously, if I remove the ! I do get the union of the results. But I want all categories except that one, plus all mfr id I specified.=

Reply via email to