Skip to content

Commit

Permalink
Minor bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gopal-msr committed Oct 21, 2024
1 parent 532ab2f commit b47a66b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions include/pq_flash_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ template <typename T, typename LabelT = uint32_t> class PQFlashIndex

DISKANN_DLLEXPORT uint64_t get_data_dim();

DISKANN_DLLEXPORT LabelT
get_converted_label(const std::string &filter_label);

std::shared_ptr<AlignedFileReader> &reader;

DISKANN_DLLEXPORT diskann::Metric get_metric();
Expand Down
10 changes: 9 additions & 1 deletion src/pq_flash_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -54,6 +55,7 @@ namespace diskann {
this->_dist_cmp.reset(diskann::get_distance_function<T>(metric_to_invoke));
this->_dist_cmp_float.reset(
diskann::get_distance_function<float>(metric_to_invoke));
this->_filter_store = std::make_unique<InMemFilterStore<LabelT>>();
}

template<typename T, typename LabelT>
Expand Down Expand Up @@ -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++;
Expand Down Expand Up @@ -1394,6 +1396,12 @@ namespace diskann {
return this->metric;
}

template<typename T, typename LabelT>
LabelT PQFlashIndex<T, LabelT>::get_converted_label(
const std::string &filter_label) {
return _filter_store->get_converted_label(filter_label);
}

#ifdef EXEC_ENV_OLS
template<typename T, typename LabelT>
char *PQFlashIndex<T, LabelT>::getHeaderBytes() {
Expand Down

0 comments on commit b47a66b

Please sign in to comment.