In order to mininize the chances of “unwanted surprises” in your search result or sorting, prehaps you would like to “massage” your data before you proceed:
- trim all html tags (like <b>)
- unescape all html characters (convert © to ©)
- finally do a String.trim() to remove unwanted spaces in your index terms.
For example when you are doing a sorting with “a”, ” b” and because ” b” contains a space in front, hence ” b” will appears on top of “a”. - (Optional) turn your data lower-case
Read full article from Apache Lucene: How to Sort Results by Alphabetical Order? | My Geek Journey
No comments:
Post a Comment