Word2VecSynonymFilter constructor null check (#12169)

This commit is contained in:
Alessandro Benedetti 2023-04-24 17:28:12 +02:00
parent 1f4f2bf509
commit 4deb0003c4
1 changed files with 3 additions and 0 deletions

View File

@ -65,6 +65,9 @@ public final class Word2VecSynonymFilter extends TokenFilter {
int maxSynonymsPerTerm,
float minAcceptedSimilarity) {
super(input);
if (synonymProvider == null) {
throw new IllegalArgumentException("The SynonymProvider must be non-null");
}
this.synonymProvider = synonymProvider;
this.maxSynonymsPerTerm = maxSynonymsPerTerm;
this.minAcceptedSimilarity = minAcceptedSimilarity;