lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Byrne <>
Subject Re: Looking for "Exact match but no other terms"... how to express it?
Date Tue, 30 Oct 2007 16:22:01 GMT
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!


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message