From 9a9154b6310c27a58fe5a79dacd28e477262eda7 Mon Sep 17 00:00:00 2001 From: Harpreet Sangar Date: Thu, 13 Apr 2023 14:49:46 +0530 Subject: [PATCH] Fix approximation logic of filter matches in case of `!=`. --- src/index.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/index.cpp b/src/index.cpp index 44fb93dc..5fd2a0ac 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -2095,9 +2095,8 @@ Option Index::_approximate_filter_ids(const filter& a_filter, } } - if (a_filter.apply_not_equals) { - auto all_ids_size = seq_ids->num_ids(); - filter_ids_length = (all_ids_size - filter_ids_length); + if (a_filter.apply_not_equals && filter_ids_length == 0) { + filter_ids_length = seq_ids->num_ids(); } return Option(true);