From b47a66be8c92f8f8be528c0fa0b1595dd556aaf8 Mon Sep 17 00:00:00 2001 From: Gopal Srinivasa Date: Tue, 22 Oct 2024 01:22:59 +0530 Subject: [PATCH] Minor bug fix --- include/pq_flash_index.h | 3 +++ src/pq_flash_index.cpp | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/pq_flash_index.h b/include/pq_flash_index.h index 7f451371f..daef93571 100644 --- a/include/pq_flash_index.h +++ b/include/pq_flash_index.h @@ -91,6 +91,9 @@ template class PQFlashIndex DISKANN_DLLEXPORT uint64_t get_data_dim(); + DISKANN_DLLEXPORT LabelT + get_converted_label(const std::string &filter_label); + std::shared_ptr &reader; DISKANN_DLLEXPORT diskann::Metric get_metric(); diff --git a/src/pq_flash_index.cpp b/src/pq_flash_index.cpp index a220382ec..d7c490fe8 100644 --- a/src/pq_flash_index.cpp +++ b/src/pq_flash_index.cpp @@ -8,6 +8,7 @@ #include "pq_scratch.h" #include "pq_flash_index.h" #include "cosine_similarity.h" +#include "in_mem_filter_store.h" #ifdef _WINDOWS #include "windows_aligned_file_reader.h" @@ -54,6 +55,7 @@ namespace diskann { this->_dist_cmp.reset(diskann::get_distance_function(metric_to_invoke)); this->_dist_cmp_float.reset( diskann::get_distance_function(metric_to_invoke)); + this->_filter_store = std::make_unique>(); } template @@ -1235,7 +1237,7 @@ namespace diskann { // if (use_filter && !(point_has_label(id, filter_label)) && // (!_use_universal_label || !point_has_label(id, // _universal_filter_label))) - if (use_filter && _filter_store->point_has_label_or_universal_label( + if (use_filter && !_filter_store->point_has_label_or_universal_label( id, filter_label)) continue; cmps++; @@ -1394,6 +1396,12 @@ namespace diskann { return this->metric; } + template + LabelT PQFlashIndex::get_converted_label( + const std::string &filter_label) { + return _filter_store->get_converted_label(filter_label); + } + #ifdef EXEC_ENV_OLS template char *PQFlashIndex::getHeaderBytes() {