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 Mike Streeton <mi...@ardentia.co.uk> on 2005/10/27 17:57:51 UTC

Terms contain spaces

I have been given an index with a term that has been stored as a keyword
and contains spaces. We are parsing a query using QueryParser but given
'myfield:"abc def"' it generates a PhraseQuery for myfield:abc and
myfield:def. What is needed is a TermQuery(new Term(myfield,"abc def")).
Can you tell query parser what to generate for strings in quotes? 

 

Thanks

 

Mike


Re: Terms contain spaces

Posted by Volodymyr Bychkoviak <vb...@i-hypergrid.com>.
Hi.

You can extend QueryParser and overwrite method getFieldQuery(String 
field, String queryText) and define your own behavior.

But be careful not to call static method parse on it because you'll get 
old QP.

Mike Streeton wrote:
> I have been given an index with a term that has been stored as a keyword
> and contains spaces. We are parsing a query using QueryParser but given
> 'myfield:"abc def"' it generates a PhraseQuery for myfield:abc and
> myfield:def. What is needed is a TermQuery(new Term(myfield,"abc def")).
> Can you tell query parser what to generate for strings in quotes? 
>
>  
>
> Thanks
>
>  
>
> Mike
>
>
>   

-- 
regards,
Volodymyr Bychkoviak


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