diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2021-03-17 15:19:37 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2021-03-17 16:31:09 +0100 |
commit | 487c23e52f78c796cfdf5c38ec0024a258648f03 (patch) | |
tree | 2105e719626c3fb63f2750ce6f04ff9829aabb48 /searchlib | |
parent | 7729ac06e11fc6952b8d48e2af22b9676de3ee93 (diff) |
Wire in ordering enum in EnumStore.
Diffstat (limited to 'searchlib')
8 files changed, 82 insertions, 71 deletions
diff --git a/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp b/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp index 087968ff8d9..3690533eef9 100644 --- a/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp +++ b/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp @@ -27,7 +27,7 @@ using NodeAllocator = TreeType::NodeAllocatorType; TEST("requireThatNumericLessIsWorking") { - NumericEnumStore es(false); + NumericEnumStore es(false, DictionaryConfig::Ordering::ORDERED); EnumIndex e1 = es.insert(10); EnumIndex e2 = es.insert(30); auto cmp1 = es.make_comparator(); @@ -41,7 +41,7 @@ TEST("requireThatNumericLessIsWorking") TEST("requireThatNumericEqualIsWorking") { - NumericEnumStore es(false); + NumericEnumStore es(false, DictionaryConfig::Ordering::ORDERED); EnumIndex e1 = es.insert(10); EnumIndex e2 = es.insert(30); auto cmp1 = es.make_comparator(); @@ -56,7 +56,7 @@ TEST("requireThatNumericEqualIsWorking") TEST("requireThatFloatLessIsWorking") { - FloatEnumStore es(false); + FloatEnumStore es(false, DictionaryConfig::Ordering::ORDERED); EnumIndex e1 = es.insert(10.5); EnumIndex e2 = es.insert(30.5); EnumIndex e3 = es.insert(std::numeric_limits<float>::quiet_NaN()); @@ -74,7 +74,7 @@ TEST("requireThatFloatLessIsWorking") TEST("requireThatFloatEqualIsWorking") { - FloatEnumStore es(false); + FloatEnumStore es(false, DictionaryConfig::Ordering::ORDERED); EnumIndex e1 = es.insert(10.5); EnumIndex e2 = es.insert(30.5); EnumIndex e3 = es.insert(std::numeric_limits<float>::quiet_NaN()); @@ -93,7 +93,7 @@ TEST("requireThatFloatEqualIsWorking") TEST("requireThatStringLessIsWorking") { - StringEnumStore es(false); + StringEnumStore es(false, DictionaryConfig::Ordering::ORDERED); EnumIndex e1 = es.insert("Aa"); EnumIndex e2 = es.insert("aa"); EnumIndex e3 = es.insert("aB"); @@ -110,7 +110,7 @@ TEST("requireThatStringLessIsWorking") TEST("requireThatStringEqualIsWorking") { - StringEnumStore es(false); + StringEnumStore es(false, DictionaryConfig::Ordering::ORDERED); EnumIndex e1 = es.insert("Aa"); EnumIndex e2 = es.insert("aa"); EnumIndex e3 = es.insert("aB"); @@ -127,7 +127,7 @@ TEST("requireThatStringEqualIsWorking") TEST("requireThatComparatorWithTreeIsWorking") { - NumericEnumStore es(false); + NumericEnumStore es(false, DictionaryConfig::Ordering::ORDERED); vespalib::GenerationHandler g; TreeType t; NodeAllocator m; @@ -152,7 +152,7 @@ TEST("requireThatComparatorWithTreeIsWorking") TEST("requireThatFoldedLessIsWorking") { - StringEnumStore es(false); + StringEnumStore es(false, DictionaryConfig::Ordering::ORDERED); EnumIndex e1 = es.insert("Aa"); EnumIndex e2 = es.insert("aa"); EnumIndex e3 = es.insert("aB"); @@ -172,7 +172,7 @@ TEST("requireThatFoldedLessIsWorking") TEST("requireThatFoldedEqualIsWorking") { - StringEnumStore es(false); + StringEnumStore es(false, DictionaryConfig::Ordering::ORDERED); EnumIndex e1 = es.insert("Aa"); EnumIndex e2 = es.insert("aa"); EnumIndex e3 = es.insert("aB"); diff --git a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp index 43e694f0bcd..00b13e1eabb 100644 --- a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp +++ b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp @@ -61,7 +61,7 @@ class FloatEnumStoreTest : public ::testing::Test { public: EnumStoreT es; FloatEnumStoreTest() - : es(false) + : es(false, DictionaryConfig::Ordering::ORDERED) {} }; @@ -105,7 +105,7 @@ TYPED_TEST(FloatEnumStoreTest, numbers_can_be_inserted_and_retrieved) TEST(EnumStoreTest, test_find_folded_on_string_enum_store) { - StringEnumStore ses(false); + StringEnumStore ses(false, DictionaryConfig::Ordering::ORDERED); std::vector<EnumIndex> indices; std::vector<std::string> unique({"", "one", "two", "TWO", "Two", "three"}); for (std::string &str : unique) { @@ -156,7 +156,7 @@ public: void StringEnumStoreTest::testInsert(bool hasPostings) { - StringEnumStore ses(hasPostings); + StringEnumStore ses(hasPostings, DictionaryConfig::Ordering::ORDERED); std::vector<EnumIndex> indices; std::vector<std::string> unique; @@ -206,7 +206,7 @@ TEST_F(StringEnumStoreTest, test_insert_on_store_with_posting_lists) TEST(EnumStoreTest, test_hold_lists_and_generation) { - StringEnumStore ses(false); + StringEnumStore ses(false, DictionaryConfig::Ordering::ORDERED); StringVector uniques; generation_t sesGen = 0u; uniques.reserve(100); @@ -283,7 +283,7 @@ dec_ref_count(NumericEnumStore& store, NumericEnumStore::Index idx) TEST(EnumStoreTest, address_space_usage_is_reported) { const size_t ADDRESS_LIMIT = 4290772994; // Max allocated elements in un-allocated buffers + allocated elements in allocated buffers. - NumericEnumStore store(false); + NumericEnumStore store(false, DictionaryConfig::Ordering::ORDERED); using vespalib::AddressSpace; EXPECT_EQ(AddressSpace(1, 1, ADDRESS_LIMIT), store.get_address_space_usage()); @@ -305,7 +305,7 @@ public: EnumIndex i5; BatchUpdaterTest() - : store(false), + : store(false, DictionaryConfig::Ordering::ORDERED), i3(), i5() { @@ -383,7 +383,7 @@ public: static std::vector<EntryType> values; LoaderTest() - : store(true) + : store(true, DictionaryConfig::Ordering::ORDERED) {} void load_values(enumstore::EnumeratedLoaderBase& loader) const { diff --git a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp index dd08b2a48b6..34e913a4c07 100644 --- a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp +++ b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp @@ -8,6 +8,7 @@ #include <vespa/vespalib/btree/btreenodeallocator.hpp> #include <vespa/vespalib/btree/btreeroot.hpp> #include <vespa/vespalib/datastore/datastore.hpp> +#include <vespa/vespalib/datastore/simple_hash_map.h> #include <vespa/vespalib/datastore/unique_store_dictionary.hpp> #include <vespa/searchlib/util/bufferwriter.h> @@ -22,9 +23,9 @@ namespace search { using vespalib::btree::BTreeNode; -template <typename DictionaryT> +template <typename DictionaryT, typename UnorderedDictionaryT> void -EnumStoreDictionary<DictionaryT>::remove_unused_values(const IndexSet& unused, +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::remove_unused_values(const IndexSet& unused, const vespalib::datastore::EntryComparator& cmp) { if (unused.empty()) { @@ -35,26 +36,26 @@ EnumStoreDictionary<DictionaryT>::remove_unused_values(const IndexSet& unused, } } -template <typename DictionaryT> -EnumStoreDictionary<DictionaryT>::EnumStoreDictionary(IEnumStore& enumStore) - : ParentUniqueStoreDictionary(), +template <typename DictionaryT, typename UnorderedDictionaryT> +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::EnumStoreDictionary(IEnumStore& enumStore, std::unique_ptr<EntryComparator> compare) + : ParentUniqueStoreDictionary(std::move(compare)), _enumStore(enumStore) { } -template <typename DictionaryT> -EnumStoreDictionary<DictionaryT>::~EnumStoreDictionary() = default; +template <typename DictionaryT, typename UnorderedDictionaryT> +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::~EnumStoreDictionary() = default; -template <typename DictionaryT> +template <typename DictionaryT, typename UnorderedDictionaryT> void -EnumStoreDictionary<DictionaryT>::set_ref_counts(const EnumVector& hist) +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::set_ref_counts(const EnumVector& hist) { _enumStore.set_ref_counts(hist, this->_dict); } -template <typename DictionaryT> +template <typename DictionaryT, typename UnorderedDictionaryT> void -EnumStoreDictionary<DictionaryT>::free_unused_values(const vespalib::datastore::EntryComparator& cmp) +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::free_unused_values(const vespalib::datastore::EntryComparator& cmp) { IndexSet unused; @@ -65,9 +66,9 @@ EnumStoreDictionary<DictionaryT>::free_unused_values(const vespalib::datastore:: remove_unused_values(unused, cmp); } -template <typename DictionaryT> +template <typename DictionaryT, typename UnorderedDictionaryT> void -EnumStoreDictionary<DictionaryT>::free_unused_values(const IndexSet& to_remove, +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::free_unused_values(const IndexSet& to_remove, const vespalib::datastore::EntryComparator& cmp) { IndexSet unused; @@ -77,9 +78,9 @@ EnumStoreDictionary<DictionaryT>::free_unused_values(const IndexSet& to_remove, remove_unused_values(unused, cmp); } -template <typename DictionaryT> +template <typename DictionaryT, typename UnorderedDictionaryT> void -EnumStoreDictionary<DictionaryT>::remove(const EntryComparator &comp, EntryRef ref) +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::remove(const EntryComparator &comp, EntryRef ref) { assert(ref.valid()); auto itr = this->_dict.lowerBound(ref, comp); @@ -90,9 +91,9 @@ EnumStoreDictionary<DictionaryT>::remove(const EntryComparator &comp, EntryRef r this->_dict.remove(itr); } -template <typename DictionaryT> +template <typename DictionaryT, typename UnorderedDictionaryT> bool -EnumStoreDictionary<DictionaryT>::find_index(const vespalib::datastore::EntryComparator& cmp, +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::find_index(const vespalib::datastore::EntryComparator& cmp, Index& idx) const { auto itr = this->_dict.find(Index(), cmp); @@ -103,9 +104,9 @@ EnumStoreDictionary<DictionaryT>::find_index(const vespalib::datastore::EntryCom return true; } -template <typename DictionaryT> +template <typename DictionaryT, typename UnorderedDictionaryT> bool -EnumStoreDictionary<DictionaryT>::find_frozen_index(const vespalib::datastore::EntryComparator& cmp, +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::find_frozen_index(const vespalib::datastore::EntryComparator& cmp, Index& idx) const { auto itr = this->_dict.getFrozenView().find(Index(), cmp); @@ -116,9 +117,9 @@ EnumStoreDictionary<DictionaryT>::find_frozen_index(const vespalib::datastore::E return true; } -template <typename DictionaryT> +template <typename DictionaryT, typename UnorderedDictionaryT> std::vector<IEnumStore::EnumHandle> -EnumStoreDictionary<DictionaryT>::find_matching_enums(const vespalib::datastore::EntryComparator& cmp) const +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::find_matching_enums(const vespalib::datastore::EntryComparator& cmp) const { std::vector<IEnumStore::EnumHandle> result; auto itr = this->_dict.getFrozenView().find(Index(), cmp); @@ -129,9 +130,9 @@ EnumStoreDictionary<DictionaryT>::find_matching_enums(const vespalib::datastore: return result; } -template <typename DictionaryT> +template <typename DictionaryT, typename UnorderedDictionaryT> EntryRef -EnumStoreDictionary<DictionaryT>::get_frozen_root() const +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::get_frozen_root() const { return this->_dict.getFrozenView().getRoot(); } @@ -143,9 +144,9 @@ EnumStoreDictionary<EnumTree>::find_posting_list(const vespalib::datastore::Entr LOG_ABORT("should not be reached"); } -template <> +template <typename DictionaryT, typename UnorderedDictionaryT> std::pair<IEnumStore::Index, EntryRef> -EnumStoreDictionary<EnumPostingTree>::find_posting_list(const vespalib::datastore::EntryComparator& cmp, EntryRef root) const +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::find_posting_list(const vespalib::datastore::EntryComparator& cmp, EntryRef root) const { typename DictionaryType::ConstIterator itr(vespalib::btree::BTreeNode::Ref(), this->_dict.getAllocator()); itr.lower_bound(root, Index(), cmp); @@ -155,16 +156,16 @@ EnumStoreDictionary<EnumPostingTree>::find_posting_list(const vespalib::datastor return std::make_pair(Index(), EntryRef()); } -template <typename DictionaryT> +template <typename DictionaryT, typename UnorderedDictionaryT> void -EnumStoreDictionary<DictionaryT>::collect_folded(Index idx, EntryRef, const std::function<void(vespalib::datastore::EntryRef)>& callback) const +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::collect_folded(Index idx, EntryRef, const std::function<void(vespalib::datastore::EntryRef)>& callback) const { callback(idx); } -template <typename DictionaryT> +template <typename DictionaryT, typename UnorderedDictionaryT> IEnumStore::Index -EnumStoreDictionary<DictionaryT>::remap_index(Index idx) +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::remap_index(Index idx) { return idx; } @@ -176,9 +177,9 @@ EnumStoreDictionary<EnumTree>::clear_all_posting_lists(std::function<void(EntryR LOG_ABORT("should not be reached"); } -template <> +template <typename DictionaryT, typename UnorderedDictionaryT> void -EnumStoreDictionary<EnumPostingTree>::clear_all_posting_lists(std::function<void(EntryRef)> clearer) +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::clear_all_posting_lists(std::function<void(EntryRef)> clearer) { auto& dict = this->_dict; auto itr = dict.begin(); @@ -203,9 +204,9 @@ EnumStoreDictionary<EnumTree>::update_posting_list(Index, const vespalib::datast LOG_ABORT("should not be reached"); } -template <> +template <typename DictionaryT, typename UnorderedDictionaryT> void -EnumStoreDictionary<EnumPostingTree>::update_posting_list(Index idx, const vespalib::datastore::EntryComparator& cmp, std::function<EntryRef(EntryRef)> updater) +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::update_posting_list(Index idx, const vespalib::datastore::EntryComparator& cmp, std::function<EntryRef(EntryRef)> updater) { auto& dict = this->_dict; auto itr = dict.lowerBound(idx, cmp); @@ -223,11 +224,11 @@ EnumStoreDictionary<EnumTree>::get_posting_dictionary() LOG_ABORT("should not be reached"); } -template <> +template <typename DictionaryT, typename UnorderedDictionaryT> EnumPostingTree & -EnumStoreDictionary<EnumPostingTree>::get_posting_dictionary() +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::get_posting_dictionary() { - return _dict; + return this->_dict; } template <> @@ -237,15 +238,15 @@ EnumStoreDictionary<EnumTree>::get_posting_dictionary() const LOG_ABORT("should not be reached"); } -template <> +template <typename DictionaryT, typename UnorderedDictionaryT> const EnumPostingTree & -EnumStoreDictionary<EnumPostingTree>::get_posting_dictionary() const +EnumStoreDictionary<DictionaryT, UnorderedDictionaryT>::get_posting_dictionary() const { - return _dict; + return this->_dict; } -EnumStoreFoldedDictionary::EnumStoreFoldedDictionary(IEnumStore& enumStore, std::unique_ptr<EntryComparator> folded_compare) - : EnumStoreDictionary<EnumPostingTree>(enumStore), +EnumStoreFoldedDictionary::EnumStoreFoldedDictionary(IEnumStore& enumStore, std::unique_ptr<vespalib::datastore::EntryComparator> compare, std::unique_ptr<EntryComparator> folded_compare) + : EnumStoreDictionary<EnumPostingTree>(enumStore, std::move(compare)), _folded_compare(std::move(folded_compare)) { } @@ -317,6 +318,8 @@ template class EnumStoreDictionary<EnumTree>; template class EnumStoreDictionary<EnumPostingTree>; +template class EnumStoreDictionary<EnumPostingTree, vespalib::datastore::SimpleHashMap>; + } namespace vespalib::btree { diff --git a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h index 77caeed1b2d..63ccb2efac7 100644 --- a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h +++ b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h @@ -12,8 +12,8 @@ class IEnumStore; /** * Concrete dictionary for an enum store that extends the functionality of a unique store dictionary. */ -template <typename DictionaryT> -class EnumStoreDictionary : public vespalib::datastore::UniqueStoreDictionary<DictionaryT, IEnumStoreDictionary> { +template <typename DictionaryT, typename UnorderedDictionaryT = vespalib::datastore::NoUnorderedDictionary> +class EnumStoreDictionary : public vespalib::datastore::UniqueStoreDictionary<DictionaryT, IEnumStoreDictionary, UnorderedDictionaryT> { protected: using EntryRef = IEnumStoreDictionary::EntryRef; using Index = IEnumStoreDictionary::Index; @@ -22,7 +22,7 @@ private: using EnumVector = IEnumStoreDictionary::EnumVector; using IndexSet = IEnumStoreDictionary::IndexSet; using IndexVector = IEnumStoreDictionary::IndexVector; - using ParentUniqueStoreDictionary = vespalib::datastore::UniqueStoreDictionary<DictionaryT, IEnumStoreDictionary>; + using ParentUniqueStoreDictionary = vespalib::datastore::UniqueStoreDictionary<DictionaryT, IEnumStoreDictionary, UnorderedDictionaryT>; using generation_t = IEnumStoreDictionary::generation_t; IEnumStore& _enumStore; @@ -31,7 +31,7 @@ private: const vespalib::datastore::EntryComparator& cmp); public: - EnumStoreDictionary(IEnumStore& enumStore); + EnumStoreDictionary(IEnumStore& enumStore, std::unique_ptr<vespalib::datastore::EntryComparator> compare); ~EnumStoreDictionary() override; @@ -75,7 +75,7 @@ private: std::unique_ptr<vespalib::datastore::EntryComparator> _folded_compare; public: - EnumStoreFoldedDictionary(IEnumStore& enumStore, std::unique_ptr<vespalib::datastore::EntryComparator> folded_compare); + EnumStoreFoldedDictionary(IEnumStore& enumStore, std::unique_ptr<vespalib::datastore::EntryComparator> compare, std::unique_ptr<vespalib::datastore::EntryComparator> folded_compare); ~EnumStoreFoldedDictionary() override; vespalib::datastore::UniqueStoreAddResult add(const vespalib::datastore::EntryComparator& comp, std::function<vespalib::datastore::EntryRef(void)> insertEntry) override; void remove(const vespalib::datastore::EntryComparator& comp, vespalib::datastore::EntryRef ref) override; diff --git a/searchlib/src/vespa/searchlib/attribute/enumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/enumattribute.hpp index 0e14c567345..dc501dc9d89 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/enumattribute.hpp @@ -13,7 +13,7 @@ EnumAttribute<B>:: EnumAttribute(const vespalib::string &baseFileName, const AttributeVector::Config &cfg) : B(baseFileName, cfg), - _enumStore(cfg.fastSearch()) + _enumStore(cfg.fastSearch(), cfg.get_dictionary_config().getOrdering()) { this->setEnum(true); } diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.cpp b/searchlib/src/vespa/searchlib/attribute/enumstore.cpp index ecd55138df1..0961f7c87f1 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumstore.cpp +++ b/searchlib/src/vespa/searchlib/attribute/enumstore.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "enumstore.hpp" +#include <vespa/vespalib/datastore/simple_hash_map.h> #include <vespa/vespalib/util/rcuvector.hpp> #include <iomanip> @@ -41,16 +42,21 @@ EnumStoreT<const char*>::load_unique_value(const void* src, } std::unique_ptr<vespalib::datastore::IUniqueStoreDictionary> -make_enum_store_dictionary(IEnumStore &store, bool has_postings, std::unique_ptr<vespalib::datastore::EntryComparator> folded_compare) +make_enum_store_dictionary(IEnumStore &store, bool has_postings, search::DictionaryConfig::Ordering ordering, std::unique_ptr<vespalib::datastore::EntryComparator> compare, std::unique_ptr<vespalib::datastore::EntryComparator> folded_compare) { if (has_postings) { if (folded_compare) { - return std::make_unique<EnumStoreFoldedDictionary>(store, std::move(folded_compare)); + return std::make_unique<EnumStoreFoldedDictionary>(store, std::move(compare), std::move(folded_compare)); } else { - return std::make_unique<EnumStoreDictionary<EnumPostingTree>>(store); + switch (ordering) { + case search::DictionaryConfig::Ordering::UNORDERED: + return std::make_unique<EnumStoreDictionary<EnumPostingTree, vespalib::datastore::SimpleHashMap>>(store, std::move(compare)); + default: + return std::make_unique<EnumStoreDictionary<EnumPostingTree>>(store, std::move(compare)); + } } } else { - return std::make_unique<EnumStoreDictionary<EnumTree>>(store); + return std::make_unique<EnumStoreDictionary<EnumTree>>(store, std::move(compare)); } } diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.h b/searchlib/src/vespa/searchlib/attribute/enumstore.h index 11a923a2b80..8bff68b8408 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumstore.h +++ b/searchlib/src/vespa/searchlib/attribute/enumstore.h @@ -7,6 +7,7 @@ #include "enumcomparator.h" #include "i_enum_store.h" #include "loadedenumvalue.h" +#include <vespa/searchcommon/common/dictionary_config.h> #include <vespa/searchlib/util/foldedstringcompare.h> #include <vespa/vespalib/btree/btreenode.h> #include <vespa/vespalib/btree/btreenodeallocator.h> @@ -73,7 +74,7 @@ private: ssize_t load_unique_value(const void* src, size_t available, Index& idx); public: - EnumStoreT(bool has_postings); + EnumStoreT(bool has_postings, search::DictionaryConfig::Ordering ordering); virtual ~EnumStoreT(); uint32_t get_ref_count(Index idx) const { return get_entry_base(idx).get_ref_count(); } @@ -213,7 +214,7 @@ public: }; std::unique_ptr<vespalib::datastore::IUniqueStoreDictionary> -make_enum_store_dictionary(IEnumStore &store, bool has_postings, std::unique_ptr<vespalib::datastore::EntryComparator> folded_compare); +make_enum_store_dictionary(IEnumStore &store, bool has_postings, search::DictionaryConfig::Ordering ordering, std::unique_ptr<vespalib::datastore::EntryComparator> compare, std::unique_ptr<vespalib::datastore::EntryComparator> folded_compare); template <> diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.hpp b/searchlib/src/vespa/searchlib/attribute/enumstore.hpp index c1098f079e6..69c412324e1 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumstore.hpp +++ b/searchlib/src/vespa/searchlib/attribute/enumstore.hpp @@ -72,13 +72,14 @@ EnumStoreT<EntryT>::load_unique_value(const void* src, size_t available, Index& } template <typename EntryT> -EnumStoreT<EntryT>::EnumStoreT(bool has_postings) +EnumStoreT<EntryT>::EnumStoreT(bool has_postings, search::DictionaryConfig::Ordering ordering) : _store(), _dict(), _cached_values_memory_usage(), _cached_values_address_space_usage(0, 0, (1ull << 32)) { - _store.set_dictionary(make_enum_store_dictionary(*this, has_postings, + _store.set_dictionary(make_enum_store_dictionary(*this, has_postings, ordering, + std::make_unique<ComparatorType>(_store.get_data_store()), (has_string_type() ? std::make_unique<FoldedComparatorType>(_store.get_data_store()) : std::unique_ptr<vespalib::datastore::EntryComparator>()))); |