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 Yousef Ourabi <yo...@gmail.com> on 2005/07/06 21:01:27 UTC

n-Field search w/PhraseQuery

Quick question on the proper-way of searching multiple fields for phrases?

Would I do this:
BooleanQuery titleOrContent = new BooleanQuery();
PhraseQuery titlePhraseSearch = new PhraseQuery(); (add filed x, and term 1, 2)
PhraseQuery contentPhraseSearch = new PhraseQuery(); (add field y, and term 2,4)

OR

PhraseQuery phraseQuery = new PhraseQuery(); add field x, t 1,2 then
add field y, t 2 4?

Thanks for any help?

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


Re: n-Field search w/PhraseQuery

Posted by Yousef Ourabi <yo...@gmail.com>.
Thanks for the reply, clears things up, have to use boolean query. Thank!

On 7/6/05, Erik Hatcher <er...@ehatchersolutions.com> wrote:
> 
> On Jul 6, 2005, at 3:01 PM, Yousef Ourabi wrote:
> 
> > Quick question on the proper-way of searching multiple fields for
> > phrases?
> >
> > Would I do this:
> > BooleanQuery titleOrContent = new BooleanQuery();
> > PhraseQuery titlePhraseSearch = new PhraseQuery(); (add filed x,
> > and term 1, 2)
> > PhraseQuery contentPhraseSearch = new PhraseQuery(); (add field y,
> > and term 2,4)
> >
> > OR
> >
> > PhraseQuery phraseQuery = new PhraseQuery(); add field x, t 1,2 then
> > add field y, t 2 4?
> 
> With those two options, you don't really have a choice.  PhraseQuery
> only can use a single field.  It doesn't really make sense for it to
> be otherwise.
> 
>      Erik
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
>

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


Re: n-Field search w/PhraseQuery

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jul 6, 2005, at 3:01 PM, Yousef Ourabi wrote:

> Quick question on the proper-way of searching multiple fields for  
> phrases?
>
> Would I do this:
> BooleanQuery titleOrContent = new BooleanQuery();
> PhraseQuery titlePhraseSearch = new PhraseQuery(); (add filed x,  
> and term 1, 2)
> PhraseQuery contentPhraseSearch = new PhraseQuery(); (add field y,  
> and term 2,4)
>
> OR
>
> PhraseQuery phraseQuery = new PhraseQuery(); add field x, t 1,2 then
> add field y, t 2 4?

With those two options, you don't really have a choice.  PhraseQuery  
only can use a single field.  It doesn't really make sense for it to  
be otherwise.

     Erik


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