Add null check

This commit is contained in:
Anh Dung Bui 2024-11-22 09:28:00 +09:00
parent 8cd3ccf441
commit 30e377a361
1 changed files with 4 additions and 1 deletions

View File

@ -67,6 +67,9 @@ public class RerankKnnFloatVectorQuery extends Query {
continue; continue;
} }
FieldInfo fi = leaf.reader().getFieldInfos().fieldInfo(query.getField()); FieldInfo fi = leaf.reader().getFieldInfos().fieldInfo(query.getField());
if (fi == null) {
continue;
}
VectorSimilarityFunction comparer = fi.getVectorSimilarityFunction(); VectorSimilarityFunction comparer = fi.getVectorSimilarityFunction();
DocIdSetIterator iterator = scorer.iterator(); DocIdSetIterator iterator = scorer.iterator();
while (iterator.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) { while (iterator.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) {
@ -95,7 +98,7 @@ public class RerankKnnFloatVectorQuery extends Query {
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
RerankKnnFloatVectorQuery that = (RerankKnnFloatVectorQuery) o; RerankKnnFloatVectorQuery that = (RerankKnnFloatVectorQuery) o;
return Objects.equals(query, that.query) && k == that.k; return Objects.equals(query, that.query) && Arrays.equals(target, that.target) && k == that.k;
} }
@Override @Override