From 225d91c6d617e3270d7cb2e553d479c92c20b59b Mon Sep 17 00:00:00 2001 From: Kishore Nallan Date: Thu, 12 Jan 2023 18:42:44 +0530 Subject: [PATCH] Fix insufficient results during filtering. Very similar in nature to https://github.com/nmslib/hnswlib/pull/344 --- hnswlib/hnswalg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hnswlib/hnswalg.h b/hnswlib/hnswalg.h index 7f34e62b..fd99f10c 100644 --- a/hnswlib/hnswalg.h +++ b/hnswlib/hnswalg.h @@ -306,7 +306,8 @@ class HierarchicalNSW : public AlgorithmInterface { while (!candidate_set.empty()) { std::pair current_node_pair = candidate_set.top(); - if ((-current_node_pair.first) > lowerBound && (top_candidates.size() == ef || has_deletions == false)) { + if ((-current_node_pair.first) > lowerBound && + (top_candidates.size() == ef || (!isIdAllowed && !has_deletions))) { break; } candidate_set.pop();