aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2021-03-23 18:34:49 +0100
committerTor Egge <Tor.Egge@broadpark.no>2021-03-23 18:34:49 +0100
commit3db12ce76a8034d9df44cbedc3919b4843e51269 (patch)
tree296078eb4c47489976d03abf1ed3942bc5dc3b73
parent1ac10c0540fece256d8b0d4ea25e61c7c35162a4 (diff)
Reduce direct usage of EnumStoreDictionary B-tree.
-rw-r--r--searchlib/src/tests/attribute/enumstore/enumstore_test.cpp10
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp14
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h1
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enumstore.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/i_enum_store_dictionary.h1
5 files changed, 6 insertions, 22 deletions
diff --git a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp
index 8ce3de52521..7536c6c66cf 100644
--- a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp
+++ b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp
@@ -495,10 +495,11 @@ public:
}
void expect_posting_idx(size_t values_idx, uint32_t exp_posting_idx) const {
- auto cmp = store.make_comparator();
- auto itr = store.get_posting_dictionary().find(find_index(values_idx), cmp);
- ASSERT_TRUE(itr.valid());
- EXPECT_EQ(exp_posting_idx, itr.getData());
+ auto cmp = store.make_comparator(Values::values[values_idx]);
+ auto &dict = store.get_dictionary();
+ auto find_result = dict.find_posting_list(cmp, dict.get_frozen_root());
+ ASSERT_TRUE(find_result.first.valid());
+ EXPECT_EQ(exp_posting_idx, find_result.second.ref());
}
};
@@ -554,6 +555,7 @@ TYPED_TEST(LoaderTest, store_is_instantiated_with_non_enumerated_loader)
loader.build_dictionary();
this->expect_values_in_store();
+ this->store.freeze_dictionary();
this->expect_posting_idx(0, 100);
this->expect_posting_idx(1, 101);
diff --git a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp
index b8d61d61023..59313134966 100644
--- a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp
@@ -267,20 +267,6 @@ EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::check_posting_lists(std:
}
template <>
-EnumPostingTree &
-EnumStoreDictionary<EnumTree>::get_posting_dictionary()
-{
- LOG_ABORT("should not be reached");
-}
-
-template <typename DictionaryT, typename UnorderedDictionaryT>
-EnumPostingTree &
-EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::get_posting_dictionary()
-{
- return this->_dict;
-}
-
-template <>
const EnumPostingTree &
EnumStoreDictionary<EnumTree>::get_posting_dictionary() const
{
diff --git a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h
index 91dc2ad1cd1..6329288f874 100644
--- a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h
+++ b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h
@@ -57,7 +57,6 @@ public:
void clear_all_posting_lists(std::function<void(EntryRef)> clearer) override;
void update_posting_list(Index idx, const vespalib::datastore::EntryComparator& cmp, std::function<EntryRef(EntryRef)> updater) override;
bool check_posting_lists(std::function<EntryRef(EntryRef)> updater) override;
- EnumPostingTree& get_posting_dictionary() override;
const EnumPostingTree& get_posting_dictionary() const override;
};
diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.h b/searchlib/src/vespa/searchlib/attribute/enumstore.h
index 02b2ec019f6..6d77295db08 100644
--- a/searchlib/src/vespa/searchlib/attribute/enumstore.h
+++ b/searchlib/src/vespa/searchlib/attribute/enumstore.h
@@ -101,8 +101,6 @@ public:
IEnumStoreDictionary& get_dictionary() override { return *_dict; }
const IEnumStoreDictionary& get_dictionary() const override { return *_dict; }
- EnumPostingTree& get_posting_dictionary() { return _dict->get_posting_dictionary(); }
- const EnumPostingTree& get_posting_dictionary() const { return _dict->get_posting_dictionary(); }
bool get_value(Index idx, EntryType& value) const;
EntryType get_value(uint32_t idx) const { return get_value(Index(EntryRef(idx))); }
diff --git a/searchlib/src/vespa/searchlib/attribute/i_enum_store_dictionary.h b/searchlib/src/vespa/searchlib/attribute/i_enum_store_dictionary.h
index 66ff0ec95f3..f452ef01e5e 100644
--- a/searchlib/src/vespa/searchlib/attribute/i_enum_store_dictionary.h
+++ b/searchlib/src/vespa/searchlib/attribute/i_enum_store_dictionary.h
@@ -53,7 +53,6 @@ public:
virtual void clear_all_posting_lists(std::function<void(EntryRef)> clearer) = 0;
virtual void update_posting_list(Index idx, const vespalib::datastore::EntryComparator& cmp, std::function<EntryRef(EntryRef)> updater) = 0;
virtual bool check_posting_lists(std::function<EntryRef(EntryRef)> updater) = 0;
- virtual EnumPostingTree& get_posting_dictionary() = 0;
virtual const EnumPostingTree& get_posting_dictionary() const = 0;
};