You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Erel Uziel <er...@basic4ppc.com> on 2016/08/15 08:02:47 UTC

Combination of BooleanQuery and PhraseQuery

Hi,
Is there any query similar to BooleanQuery with SHOULD semantics that prefer
documents where the terms are close to each other?
I currently use a PhraseQuery with large slop for this. However this only
works if all the terms are in the document.
 
Best regards, 
Erel Uziel


Re: Combination of BooleanQuery and PhraseQuery

Posted by Erik Hatcher <er...@gmail.com>.
Try combining into multiple clauses… (with q.op=OR)

   “some phrase”~9999  OR (some phrase) 

That would boost docs with with proximity, but still allow matches for docs that don’t contain all terms.

	Erik



> On Aug 15, 2016, at 4:02 AM, Erel Uziel <er...@basic4ppc.com> wrote:
> 
> Hi,
> Is there any query similar to BooleanQuery with SHOULD semantics that prefer
> documents where the terms are close to each other?
> I currently use a PhraseQuery with large slop for this. However this only
> works if all the terms are in the document.
> 
> Best regards, 
> Erel Uziel
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org