On Apr 27, 2007, at 6:08 AM, karl wettin wrote:
27 apr 2007 kl. 08.21 skrev Kun Hong:

I just want that one document which
contains no other words than "the". Is it possible using Lucene query?

Take a look at SpanFirstQuery. Perhaps you would need implement a SpanLastQuery too.

Perhaps the easiest way about it would be a RegexQuery that looks something like this: "^the$"

The RegexQuery won't work in this case, as it is only matching on terms, not original field values. So it'd still pick up other titles with "the" in them (provided stop words were not removed).

If you need exact matching on original value, the easiest way is to index that value without tokenization (perhaps lowercasing though). Unless someone has some other tricks I'm not aware of, that is.

        Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to