Apache Solr open-source search software
LUCENE-9784: Hunspell suggestions: use US keyboard in absence of KEY option (#2389)
Peter Gromovf83c9862e841
diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.javaindex d22c6eb8832..23eaa1ea83e 100644--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java@@ -161,7 +161,7 @@ public class Dictionary {private char[] ignore;String tryChars = "";- String[] neighborKeyGroups = new String[0];+ String[] neighborKeyGroups = {"qwertyuiop", "asdfghjkl", "zxcvbnm"};boolean enableSplitSuggestions = true;List<RepEntry> repTable = new ArrayList<>();List<List<String>> mapTable = new ArrayList<>();diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/TestSpellChecking.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/TestSpellChecking.javaindex 57adce60605..b13a2f842eb 100644--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/TestSpellChecking.java+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/TestSpellChecking.java@@ -212,6 +212,10 @@ public class TestSpellChecking extends StemmerTestBase {doTest("nosuggest");}+ public void testUseUSKeyboardAsDefaultKeyValue() throws Exception {+ doTest("keyDefault");+ }+protected void doTest(String name) throws Exception {checkSpellCheckerExpectations(Path.of(getClass().getResource(name + ".aff").toURI()).getParent().resolve(name));diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/keyDefault.aff b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/keyDefault.affnew file mode 100644index 00000000000..e69de29bb2ddiff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/keyDefault.dic b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/keyDefault.dicnew file mode 100644index 00000000000..6be6de1f74b--- /dev/null+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/keyDefault.dic@@ -0,0 +1,3 @@+2+gab+an\ No newline at end of filediff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/keyDefault.sug b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/keyDefault.sugnew file mode 100644index 00000000000..ee17e06b23a--- /dev/null+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/keyDefault.sug@@ -0,0 +1 @@+gab, an\ No newline at end of filediff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/keyDefault.wrong b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/keyDefault.wrongnew file mode 100644index 00000000000..774b591bd5d--- /dev/null+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/keyDefault.wrong@@ -0,0 +1 @@+gan\ No newline at end of file