You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by s d <s....@gmail.com> on 2008/05/12 18:31:36 UTC

result limit / diversity with an OR query

Hi,I have a query similar to: x OR y OR z and i want to know if there is a
way to make sure i get 1 result with x, 1 result with y and one with z ?
Alternatively, is it possible to achieve through facets?
Thanks,
S.

Re: result limit / diversity with an OR query

Posted by Francisco Sanmartin <fr...@olx.com>.
the easy answer is: x AND y AND z . This will return ALL the documents 
containing x,y and z. But if you want also get the documents containin 
AT LEAST one of the three, try this:

(x AND y AND z)^100000 OR (x OR y OR z)

(the idea is boosting the AND query)

this way, the documents that "x and y and z" exists, they will be the firsts

Pako
s d wrote:
> Hi,I have a query similar to: x OR y OR z and i want to know if there is a
> way to make sure i get 1 result with x, 1 result with y and one with z ?
> Alternatively, is it possible to achieve through facets?
> Thanks,
> S.
>
>   


Re: result limit / diversity with an OR query

Posted by Mike Klaas <mi...@gmail.com>.
On 12-May-08, at 9:31 AM, s d wrote:

> Hi,I have a query similar to: x OR y OR z and i want to know if  
> there is a
> way to make sure i get 1 result with x, 1 result with y and one with  
> z ?

The easiest way is to execute three separate queries:
+x y z
x +y z
x y +z

-Mike