Apache Lucene open-source search software
LUCENE-9833: Hunspell: AssertionError in WordStorage.lookupWord (#13)
Peter Gromove784721e6973
diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/ModifyingSuggester.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/ModifyingSuggester.javaindex e135fb6ed0f..8f90a416bb4 100644--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/ModifyingSuggester.java+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/ModifyingSuggester.java@@ -132,6 +132,7 @@ class ModifyingSuggester {int before = result.size();for (RepEntry entry : speller.dictionary.repTable) {for (String candidate : entry.substitute(word)) {+ candidate = candidate.trim();if (trySuggestion(candidate)) {continue;}diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.aff b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.affindex 485755c8983..ff5f395c5b2 100644--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.aff+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.aff@@ -3,7 +3,7 @@# switch off ngram suggestion for testingMAXNGRAMSUGS 0-REP 8+REP 9REP f phREP ph fREP shun$ tion@@ -12,7 +12,9 @@ REP ^foo$ barREP ' _ # "un'alunno" -> "un alunno"REP ^vinte�n$ vinte_e_unREP s 's+REP - _ # art-nouveau -> art nouveau+BREAK 0SFX A Y 1SFX A 0 's .diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.dic b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.dicindex f9a4c008b0a..8d6be3416b9 100644--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.dic+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.dic@@ -1,4 +1,4 @@-10+15formphantomvacation@@ -13,3 +13,5 @@ vinteeunauto/A+art nouveau+nouveau\ No newline at end of filediff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.sug b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.sugindex b48a5b80eb0..ec15195da6a 100644--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.sug+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.sug@@ -6,3 +6,5 @@ un alunnobarvinte e unauto's, auto+art nouveau+nouveau\ No newline at end of filediff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.wrong b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.wrongindex b3254ac064e..1184a385572 100644--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.wrong+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.wrong@@ -9,3 +9,5 @@ foobarsbarfoosvinteúnautos+art-nouveau+-nouveau\ No newline at end of file