lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Storing words with apostrophe in Lucene index
Date Tue, 28 Jul 2009 06:44:05 GMT

> When user types in any of the following keywords,I want
> this company to come up in search results. 
> 1.Moo 2.Mood 3.Moodys 4.Moody's
> How should I store this index in Lucene and what type of
> Lucene Query should I use to get this behavior?

If you want to use a built-in analyzer WhitespaceAnalyzer with PrefixQuery are enough to get
this behavior.
Just add an star ( * ) end of the user query:


Note that this option will be case sensitive. 

To perform case insensitive search either you can add LowerCaseFilter to  WhitespaceAnalyzer,
or remove StandardFilter from StandardAnalyzer.
May be it is a good idea to setLowercaseExpandedTerms of your QueryParser to true, since wildcard
query words are not analyzed.

If you don't want to use wildcard searches, then EdgeNGramTokenFilter can help you.


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

View raw message