lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Krupansky" <>
Subject Re: Phrase matching with set union as opposed to set intersection on query terms
Date Wed, 05 Jun 2013 15:23:50 GMT
term1 OR term2 OR "term1 term2"^2

term1 OR term2 OR "term1 term2"~10^2

The latter would rank documents with the terms nearby higher, and the 
adjacent terms highest.

term1 OR term2 OR "term1 term2"~10^2 OR "term1 term2"^20 OR "term2 term1"^20

To further boost adjacent terms.

But the edismax pf/pf2/pf3 options might be good enough for you.

-- Jack Krupansky

-----Original Message----- 
From: Shawn Heisey
Sent: Wednesday, June 05, 2013 11:10 AM
Subject: Re: Phrase matching with set union as opposed to set intersection 
on query terms

On 6/5/2013 9:03 AM, Dotan Cohen wrote:
> How would one write a query which should perform set union on the
> search terms (term1 OR term2 OR term3), and yet also perform phrase
> matching if both terms are found? I tried a few variants of the
> following, but in every case I am getting set intersection on the
> search terms:
> select?q={!q.op=OR}text:"term1 term2"~100000

A phrase search by definition will require all terms to be present.
Even though it is multiple terms, conceptually it is treated as a single

It sounds like what you are after is what edismax can do.  If you define
the pf field in addition to the qf field, Solr will do something pretty
amazing - it will automatically construct a phrase query from a
non-phrase query and search with it against multiple fields.  Done
correctly, this means that an exact match will be listed first in the


View raw message