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 Waleed Tayea <Wa...@bibalex.org> on 2006/03/16 11:10:00 UTC

PhraseQuery

Dear All.

I'm using the QueryParser to parse and return a query of a search string
of a single word. But the analyzer I uses emits another morphological
tokens from that single word. How can I prevent the QueryParser of
considering the search query as a PhraseQuery with the terms of that
single word search string and the other morphological tokens. I just
want to make it return a BooleanQuery with Boolean clauses of all
tokens, each one with its own as a TermQuery.

 

Thanks.

Waleed Tayea



 


Re: PhraseQuery

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Mar 16, 2006, at 5:10 AM, Waleed Tayea wrote:
> I'm using the QueryParser to parse and return a query of a search  
> string
> of a single word. But the analyzer I uses emits another morphological
> tokens from that single word. How can I prevent the QueryParser of
> considering the search query as a PhraseQuery with the terms of that
> single word search string and the other morphological tokens. I just
> want to make it return a BooleanQuery with Boolean clauses of all
> tokens, each one with its own as a TermQuery.

You will need to override this behavior by subclassing QueryParser  
and overriding getFieldQuery to create the BooleanQuery yourself.

If the tokens are emitted in the same position (increment of 0) and  
you're using Lucene 1.9.x it will work differently in this case than  
1.4.3 did - positions were not taken into account in 1.4.3, but are  
in the latest version.

	Erik


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