From 66a54d85ccdf085a65fe14f5149a351ac5ef6fc7 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Fri, 22 Mar 2024 10:59:35 +0100 Subject: [PATCH] refactor: clean up --- lib_vector_search/include/bucket_finder.h | 2 +- lib_vector_search/src/bucket_finder.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_vector_search/include/bucket_finder.h b/lib_vector_search/include/bucket_finder.h index d8eae45..15b7dbe 100644 --- a/lib_vector_search/include/bucket_finder.h +++ b/lib_vector_search/include/bucket_finder.h @@ -7,7 +7,7 @@ class Bucket { private: - std::map groups_; + std::map directory_; public: void insert(const WordList &word_list, size_t first_index, size_t last_index); diff --git a/lib_vector_search/src/bucket_finder.cpp b/lib_vector_search/src/bucket_finder.cpp index 2738b0b..8fd7500 100644 --- a/lib_vector_search/src/bucket_finder.cpp +++ b/lib_vector_search/src/bucket_finder.cpp @@ -6,20 +6,20 @@ void Bucket::insert(const WordList &word_list, size_t first_index, size_t last_index) { - for (size_t index = first_index; index < last_index; ++index) { + for (auto index = first_index; index < last_index; ++index) { const auto ¤t_word = word_list[index]; - groups_[current_word.front()].push_back(¤t_word); + directory_[current_word.front()].push_back(¤t_word); } } WordRefList Bucket::find_prefix(std::string_view search_term) const { - auto group_it = groups_.find(search_term.front()); - if (group_it == groups_.cend()) { + auto directory_it = directory_.find(search_term.front()); + if (directory_it == directory_.cend()) { return {}; } WordRefList result; - for (const auto *word : group_it->second) { + for (const auto *word : directory_it->second) { if (word->starts_with(search_term)) { result.push_back(word); }