Skip to content

Commit 43233c2

Browse files
authored
Fix multi-vector batch iterator done() issue (#131)
With this PR, we can immediately detect if all labels are found without exhaustively checking all vectors.
1 parent 9fffbf4 commit 43233c2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

include/svs/index/vamana/multi.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ template <typename Index, typename QueryType> class MultiBatchIterator {
118118
const_iterator cend() const { return results_.cend(); }
119119
size_t size() const { return results_.size(); }
120120

121-
bool done() const { return batch_iterator_.done() && extra_results_.empty(); }
121+
bool done() const {
122+
return (batch_iterator_.done() && extra_results_.empty()) ||
123+
(returned_.size() == index_.labelcount());
124+
}
122125

123126
std::span<const value_type> contents() const { return lib::as_const_span(results_); }
124127

0 commit comments

Comments
 (0)