Stupid Lucene Tricks: Exact Match, Starts With, Ends With | Mark Leighton Fisher [blogs.perl.org]
"Starts With" and "Ends With" searches are an extension of this technique, as a "Starts With" search just requires adding the delimiter in front of your search term (like using "lucenematch Acer" when searching for terms starting with "Acer"). Similarly, "Negundo Ab lucenematch" will search for terms ending in "Negundo Ab".
.To make it easier for your users, you could:
- Define '^' as the first character of a search phrase meaning "Starts With".
- Define '$' as the last character of a search phrase meaning "Ends With".
- Pre-parse your search phrase, substituting '^' and '$' appropriately.
Read full article from Stupid Lucene Tricks: Exact Match, Starts With, Ends With | Mark Leighton Fisher [blogs.perl.org]
No comments:
Post a Comment