From 0b9118f08c6d5f200c5ec0058901a24178f731d0 Mon Sep 17 00:00:00 2001 From: rakri Date: Wed, 24 Jan 2024 04:37:29 +0000 Subject: [PATCH] minor changes as per PR discussion --- include/abstract_filter_store.h | 4 ++-- include/in_mem_filter_store.h | 4 ++-- python/src/builder.cpp | 1 - src/in_mem_filter_store.cpp | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/abstract_filter_store.h b/include/abstract_filter_store.h index 95b39801c..0e6316547 100644 --- a/include/abstract_filter_store.h +++ b/include/abstract_filter_store.h @@ -28,9 +28,9 @@ template class AbstractFilterStore DISKANN_DLLEXPORT virtual void swap_labels(const location_t location_first, const location_t location_second) = 0; DISKANN_DLLEXPORT virtual const tsl::robin_set &get_all_label_set() = 0; - DISKANN_DLLEXPORT virtual void add_to_label_set(label_type &label) = 0; + DISKANN_DLLEXPORT virtual void add_to_label_set(const label_type &label) = 0; // Throws: out of range exception - DISKANN_DLLEXPORT virtual void add_label_to_location(const location_t point_id, label_type label) = 0; + DISKANN_DLLEXPORT virtual void add_label_to_location(const location_t point_id, const label_type label) = 0; // returns internal mapping for given raw_label DISKANN_DLLEXPORT virtual label_type get_numeric_label(const std::string &raw_label) = 0; diff --git a/include/in_mem_filter_store.h b/include/in_mem_filter_store.h index a1b64a520..98c6a7408 100644 --- a/include/in_mem_filter_store.h +++ b/include/in_mem_filter_store.h @@ -23,9 +23,9 @@ template class InMemFilterStore : public AbstractFilterSto void set_labels_to_location(const location_t location, const std::vector &labels); void swap_labels(const location_t location_first, const location_t location_second) override; const tsl::robin_set &get_all_label_set() override; - void add_to_label_set(label_type &label) override; + void add_to_label_set(const label_type &label) override; // Throws: out of range exception - void add_label_to_location(const location_t point_id, label_type label) override; + void add_label_to_location(const location_t point_id, const label_type label) override; // returns internal mapping for given raw_label label_type get_numeric_label(const std::string &raw_label) override; diff --git a/python/src/builder.cpp b/python/src/builder.cpp index cdda322f4..4bdc1ef6e 100644 --- a/python/src/builder.cpp +++ b/python/src/builder.cpp @@ -40,7 +40,6 @@ std::string prepare_filtered_label_map(diskann::Index &index, c convert_label_to_numeric(filter_labels_file, labels_file_to_use, mem_labels_int_map_file, universal_label); if (!universal_label.empty()) { - uint32_t unv_label_as_num = 0; index.set_universal_label(universal_label); } return labels_file_to_use; diff --git a/src/in_mem_filter_store.cpp b/src/in_mem_filter_store.cpp index aa47949a9..ee8f8c16a 100644 --- a/src/in_mem_filter_store.cpp +++ b/src/in_mem_filter_store.cpp @@ -52,7 +52,7 @@ template const tsl::robin_set &InMemFilterStor return _labels; } -template void InMemFilterStore::add_to_label_set(label_type &label) +template void InMemFilterStore::add_to_label_set(const label_type &label) { _labels.insert(label); } @@ -81,7 +81,7 @@ template bool InMemFilterStore::label_has_medo } template -void InMemFilterStore::add_label_to_location(const location_t point_id, label_type label) +void InMemFilterStore::add_label_to_location(const location_t point_id, const label_type label) { _location_to_labels[point_id].emplace_back(label); }