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 John Byrne <jo...@propylon.com> on 2007/10/30 17:22:01 UTC

Re: Looking for "Exact match but no other terms"... how to express it?

Tobias Hill wrote:
> I want to match on the exact phrase "foo bar dot" on a
> specific field on my set of documents.
>
> I only want results where that field has exactly "foo bar dot"
> and no more terms. I.e. A document with "foo bar dot alu"
> should not match.
>
> A phrase query with slop 0 seems resonable but how do I
> express "but nothing more than these terms".
>
> Thankful for your feedback on this!
> Tobias
>
>   
You can do this by storing the text in an un-tokenized field. This is an 
option when you create the field. use "Field.Index.UN_TOKENIZED" as the 
option when you create the field. Then individual terms or phrases will 
not match that field. You will still be able to match it with the exact 
text, a wildcard query, or a range query.

So in your case, if the field contained "foo bar dot" you would not get 
a hit for "foo bar dot alu", but you would for "foo bar dot",  "foo*", 
"f*" or even "*".

Hope that helps!

Regards,
John.






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