Skip to content

Commit

Permalink
Fix regression in flat search cutoff score compute.
Browse files Browse the repository at this point in the history
  • Loading branch information
kishorenc committed Apr 19, 2024
1 parent fca277c commit 96127b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.cpp
Expand Up @@ -2932,7 +2932,7 @@ Option<bool> Index::search(std::vector<query_tokens_t>& field_query_tokens, cons
uint32_t filter_id_count = filter_result_iterator->approx_filter_ids_length;
if (!no_filters_provided && filter_id_count < vector_query.flat_search_cutoff) {
while (filter_result_iterator->validity == filter_result_iterator_t::valid) {
auto &seq_id = filter_result_iterator->seq_id;
auto seq_id = filter_result_iterator->seq_id;
auto filter_result = single_filter_result_t(seq_id, std::move(filter_result_iterator->reference));
filter_result_iterator->next();
std::vector<float> values;
Expand Down
5 changes: 5 additions & 0 deletions test/collection_vector_search_test.cpp
Expand Up @@ -779,6 +779,11 @@ TEST_F(CollectionVectorTest, VecSearchWithFiltering) {

ASSERT_EQ(10, results["found"].get<size_t>());
ASSERT_EQ(10, results["hits"].size());
ASSERT_FLOAT_EQ(3.409385e-05, results["hits"][0]["vector_distance"].get<float>());
ASSERT_EQ("1", results["hits"][0]["document"]["id"].get<std::string>());

ASSERT_FLOAT_EQ(0.016780376, results["hits"][1]["vector_distance"].get<float>());
ASSERT_EQ("5", results["hits"][1]["document"]["id"].get<std::string>());

// single point

Expand Down

0 comments on commit 96127b2

Please sign in to comment.