Skip to content

Commit 87b4056

Browse files
committed
Address code review comments
Signed-off-by: Andriy Redko <drreta@gmail.com>
1 parent 62867f6 commit 87b4056

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/main/java/org/opensearch/knn/index/KNNVectorScriptDocValues.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,15 @@ private static final class KNNByteVectorScriptDocValues extends KNNVectorScriptD
113113

114114
@Override
115115
protected float[] doGetValue() throws IOException {
116-
int docId = this.iterator.index();
116+
int docId = this.iterator.docID();
117117
if (docId == KnnVectorValues.DocIndexIterator.NO_MORE_DOCS) {
118118
throw new IllegalStateException("No more ordinals to retrieve vector values.");
119-
} else if (docId == GraphNodeIdToDocMap.NO_VECTOR_OR_DELETED_DOC) {
120-
return null; /* no value */
119+
}
120+
121+
int ord = this.iterator.index(); // Fetch ordinal (index of vector)
122+
if (ord == GraphNodeIdToDocMap.NO_VECTOR_OR_DELETED_DOC) {
123+
log.debug("No vector value for docId {}, index is {}", docId, ord);
124+
return null; /* no vector value */
121125
}
122126

123127
// Use the correct method to retrieve the byte vector for the current ordinal

0 commit comments

Comments
 (0)