简体   繁体   中英

Lucene Search SuggestWords()

I used the Apache Lucene library to do a search method.

   public static List<String> suggestWords(String word, Directory directory, String field) {
       blabla
   }


Text
[Text]

text
[Next, Text, Heat, Sent, Test, Texts]

Had any of you ever work on this library, I would like to understand why when i search for Text I am getting the good word/words and when i search for text the first suggested word is Next and not Text. Should I always put the first letter of the word to UpperCase before searching the suggestWords list ?

Thank you !

In the Apache Lucene Library fields names are case sensitive. That could explain your issue with the Text and text case.

To avoid your issues, you might add a String.toLowercase() or Uppercase like you said, to ensure you to have the right answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM