Skip to content

Commit 21de18f

Browse files
committed
Fix insufficient results during filtering.
Very similar in nature to nmslib#344
1 parent 7f971d4 commit 21de18f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

hnswlib/hnswalg.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ class HierarchicalNSW : public AlgorithmInterface<dist_t, filter_func_t> {
314314
while (!candidate_set.empty()) {
315315
std::pair<dist_t, tableint> current_node_pair = candidate_set.top();
316316

317-
if ((-current_node_pair.first) > lowerBound && (top_candidates.size() == ef || has_deletions == false)) {
317+
if ((-current_node_pair.first) > lowerBound &&
318+
(top_candidates.size() == ef || (is_filter_disabled && !has_deletions))) {
318319
break;
319320
}
320321
candidate_set.pop();

0 commit comments

Comments
 (0)