> 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:
Moo*
Mood*
Moodys*
Moody's*
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: [email protected]
For additional commands, e-mail: [email protected]