Skip to content

Commit

Permalink
update nextDoc
Browse files Browse the repository at this point in the history
Signed-off-by: Vijayan Balasubramanian <[email protected]>
  • Loading branch information
VijayanB committed Sep 27, 2024
1 parent 71adc4f commit 92040fd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ public int nextDoc() throws IOException {
if (docId == DocIdSetIterator.NO_MORE_DOCS) {
return DocIdSetIterator.NO_MORE_DOCS;
}
if (bitSetIterator != null) {
binaryVectorValues.advance(docId);
}
currentScore = computeScore();
int currentDocId = docId;
docId = getNextDocId();
Expand All @@ -82,9 +79,14 @@ protected float computeScore() throws IOException {
}

protected int getNextDocId() throws IOException {
if (bitSetIterator != null) {
return bitSetIterator.nextDoc();
if (bitSetIterator == null) {
return binaryVectorValues.nextDoc();
}
int nextDocID = this.bitSetIterator.nextDoc();
// For filter case, advance vector values to corresponding doc id from filter bit set
if (nextDocID != DocIdSetIterator.NO_MORE_DOCS) {
binaryVectorValues.advance(nextDocID);
}
return binaryVectorValues.nextDoc();
return nextDocID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ public int nextDoc() throws IOException {
// and parentBitSet will have [1,5]
// Hence, we have to iterate till docId from knnVectorValues is less than parentId instead of till equal to parentId
while (docId != DocIdSetIterator.NO_MORE_DOCS && docId < currentParent) {
if (bitSetIterator != null) {
binaryVectorValues.advance(docId);
}
float score = computeScore();
if (score > currentScore) {
bestChild = docId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ public int nextDoc() throws IOException {
// and parentBitSet will have [1,5]
// Hence, we have to iterate till docId from knnVectorValues is less than parentId instead of till equal to parentId
while (docId != DocIdSetIterator.NO_MORE_DOCS && docId < currentParent) {
if (bitSetIterator != null) {
knnFloatVectorValues.advance(docId);
}
float score = computeScore();
if (score > currentScore) {
bestChild = docId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ public int nextDoc() throws IOException {
if (docId == DocIdSetIterator.NO_MORE_DOCS) {
return DocIdSetIterator.NO_MORE_DOCS;
}
if (bitSetIterator != null) {
knnFloatVectorValues.advance(docId);
}
currentScore = computeScore();
int currentDocId = docId;
docId = getNextDocId();
Expand All @@ -104,9 +101,14 @@ protected float computeScore() throws IOException {
}

protected int getNextDocId() throws IOException {
if (bitSetIterator != null) {
return bitSetIterator.nextDoc();
if (bitSetIterator == null) {
return knnFloatVectorValues.nextDoc();
}
int nextDocID = this.bitSetIterator.nextDoc();
// For filter case, advance vector values to corresponding doc id from filter bit set
if (nextDocID != DocIdSetIterator.NO_MORE_DOCS) {
knnFloatVectorValues.advance(nextDocID);
}
return knnFloatVectorValues.nextDoc();
return nextDocID;
}
}

0 comments on commit 92040fd

Please sign in to comment.