lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ahmet Arslan <iori...@yahoo.com>
Subject Re: PhraseQuery vs MultiPhraseQuery
Date Fri, 28 May 2010 20:09:24 GMT


> Is there a fundamental difference between
> 
> PhraseQuery query = new PhraseQuery();
> query.add(term1, 0);
> query.add(term2, 0);
> 
> and
> 
> MultiPhraseQuery query = new MultiPhraseQuery();
> query.add( new Term[] { term1, term2 } );
> 
> The only different I could think of is that MPQ somehow
> does a OR between terms at the same position while PQ does a
> AND. Am I off base?

MPQ can support "(quick OR fast) (cat OR mice OR dog)" type of queries so that these docs
are retrieved:

quick rat
fast mice
fast dog

etc.

In your example term1=quick and term2=fast. You need to add another Term array. 
query.add( new Term[] { term1, term2 } );
query.add( new Term[] { term3, term4, term5 } );



      

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


Mime
View raw message