FAQ

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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
groupjava-user @
categorieslucene
postedJul 28, '09 at 1:20a
activeJul 28, '09 at 7:45a
posts2
users2
websitelucene.apache.org

2 users in discussion

Mitu2009: 1 post AHMET ARSLAN: 1 post

People

Translate

site design / logo © 2022 Grokbase