make sure binary value is not null in reranking
@@ -241,6 +241,7 @@ public class SimSearchUtils {
for (PropertyDefinition pd : sp) {
String fieldName = FieldNames.createBinSimilarityFieldName(pd.name);
BytesRef binaryValue = indexSearcher.doc(inputDoc.doc).getBinaryValue(fieldName);
+ if (binaryValue != null) {
double[] inputVector = toDoubleArray(binaryValue.bytes);
for (int j = 0; j < docs.scoreDocs.length; j++) {
double[] currentVector = toDoubleArray(indexSearcher.doc(docs.scoreDocs[j].doc)
@@ -256,6 +257,7 @@ public class SimSearchUtils {
docs.scoreDocs[j].score += (float) (1d / distance); // additive similarity boosting
}
}
+ }
if (!toDiscard.isEmpty()) {
docs.scoreDocs = Arrays.stream(docs.scoreDocs).filter(e -> !toDiscard.contains(e.doc)).toArray(ScoreDoc[]::new); // remove docs that are not close enough
}
