I ended up using DanishAnalyzer
. Probably better that way, anyway.
How to make the letter "A" an exception in Lucene's StandardAnalyzer?
-
10-12-2021 - |
Question
I've created a medical dictionary in Android using Lucene. The words and definitions are Danish, and I'm using StandardAnalyzer
to index and search for the entries. The idea is that when I click on an entry in my ListView
, another Activity
shows up with the word on top and the definition below it.
The dictionary works exactly as expected EXCEPT for the entry A.
. When I click on A.
in my ListView
, the next Activity
shows only the screen's background colors--no word, no definition, no any kind of text.
My guess is that StandardAnalyzer
counts the letter A
as a stop word during the indexing process, because the Activity
for the entry V.
shows up correctly. How can I get around this?
Solution 2
OTHER TIPS
You can use a StandardAnalyzer
with a different set of stop words.
For the default stop words see StandardAnalyzer.STOP_WORDS_SET
, it is copied from StopAnalyzer.ENGLISH_STOP_WORDS_SET
.
new StandardAnalyzer(Version.LUCENE_35, stopWordsSet);