diff options
Diffstat (limited to 'searchlib')
-rw-r--r-- | searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp | 23 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h | 1 |
2 files changed, 21 insertions, 3 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp index 2a544814710..1299accbfc1 100644 --- a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp +++ b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp @@ -78,6 +78,19 @@ EnumStoreDictionary<DictionaryT>::free_unused_values(const IndexSet& to_remove, } template <typename DictionaryT> +void +EnumStoreDictionary<DictionaryT>::remove(const EntryComparator &comp, EntryRef ref) +{ + assert(ref.valid()); + auto itr = this->_dict.lowerBound(ref, comp); + assert(itr.valid() && itr.getKey() == ref); + if constexpr (std::is_same_v<DictionaryT, EnumPostingTree>) { + assert(EntryRef(itr.getData()) == EntryRef()); + } + this->_dict.remove(itr); +} + +template <typename DictionaryT> bool EnumStoreDictionary<DictionaryT>::find_index(const datastore::EntryComparator& cmp, Index& idx) const @@ -184,9 +197,13 @@ EnumStoreFoldedDictionary::remove(const EntryComparator& comp, EntryRef ref) EntryRef posting_list_ref(it.getData()); _dict.remove(it); // Maybe copy posting list reference to next entry - if (posting_list_ref.valid() && it.valid() && !EntryRef(it.getData()).valid() && !(*_folded_compare)(ref, it.getKey())) { - this->_dict.thaw(it); - it.writeData(posting_list_ref.ref()); + if (posting_list_ref.valid()) { + if (it.valid() && !EntryRef(it.getData()).valid() && !(*_folded_compare)(ref, it.getKey())) { + this->_dict.thaw(it); + it.writeData(posting_list_ref.ref()); + } else { + LOG_ABORT("Posting list not cleared for removed unique value"); + } } } diff --git a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h index 5e7a63e68b4..c2c4c96c2d9 100644 --- a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h +++ b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h @@ -41,6 +41,7 @@ public: void free_unused_values(const IndexSet& to_remove, const datastore::EntryComparator& cmp) override; + void remove(const datastore::EntryComparator& comp, datastore::EntryRef ref) override; bool find_index(const datastore::EntryComparator& cmp, Index& idx) const override; bool find_frozen_index(const datastore::EntryComparator& cmp, Index& idx) const override; std::vector<attribute::IAttributeVector::EnumHandle> |