Skip to content

Commit

Permalink
Use INDEX mode if an invalid value is set for mode in the kuromoji_co…
Browse files Browse the repository at this point in the history
…mpletion filter

Signed-off-by: Tatsuya Kawakami <[email protected]>
  • Loading branch information
hogesako committed Feb 14, 2024
1 parent b48d145 commit 85caa4f
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ public KuromojiCompletionFilterFactory(IndexSettings indexSettings, Environment

public static Mode getMode(Settings settings) {
String modeSetting = settings.get("mode", null);
if (modeSetting == null || "index".equalsIgnoreCase(modeSetting)) {
return Mode.INDEX;
} else {
return Mode.QUERY;
if (modeSetting != null) {
if ("index".equalsIgnoreCase(modeSetting)) {
return Mode.INDEX;
} else if ("query".equalsIgnoreCase(modeSetting)) {
return Mode.QUERY;
}
}
return Mode.INDEX;
}

@Override
Expand Down

0 comments on commit 85caa4f

Please sign in to comment.