diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-11-21 17:54:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-21 17:54:18 +0100 |
commit | ab75d86b43fb1027c0f8684e4dbeacb28632f997 (patch) | |
tree | bf901edb29882bccd741a74e256f3375839748ab /searchlib | |
parent | 7cea30484827c35d757d9a04d758e6c3aca5e93a (diff) | |
parent | 2078de4fd0cd855e95642baa3d7ea5647af29a9f (diff) |
Merge pull request #29415 from vespa-engine/geirst/posting-list-attribute-refactor
Rename PostingList to PostingStore to be more precise.
Diffstat (limited to 'searchlib')
15 files changed, 116 insertions, 120 deletions
diff --git a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp index 62628d61d49..3d3ff469546 100644 --- a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp +++ b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp @@ -449,7 +449,7 @@ PostingListAttributeTest::checkPostingList(const VectorType & vec, const std::ve { const typename VectorType::EnumStore & enumStore = vec.getEnumStore(); auto& dict = enumStore.get_dictionary(); - const typename VectorType::PostingList & postingList = vec.getPostingList(); + const auto& posting_store = vec.get_posting_store(); for (size_t i = 0; i < values.size(); ++i) { const uint32_t docBegin = range.getBegin(i); @@ -457,10 +457,9 @@ PostingListAttributeTest::checkPostingList(const VectorType & vec, const std::ve auto find_result = dict.find_posting_list(enumStore.make_comparator(values[i]), dict.get_frozen_root()); ASSERT_TRUE(find_result.first.valid()); - bool has_bitvector = VectorType::PostingList::isBitVector(postingList.getTypeId(find_result.second)); + bool has_bitvector = VectorType::PostingStore::isBitVector(posting_store.getTypeId(find_result.second)); - typename VectorType::PostingList::Iterator postings; - postings = postingList.begin(find_result.second); + auto postings = posting_store.begin(find_result.second); uint32_t numHits(0); bool has_btree = postings.valid(); if (postings.valid()) { @@ -472,12 +471,12 @@ PostingListAttributeTest::checkPostingList(const VectorType & vec, const std::ve EXPECT_EQ(doc, docEnd); } else { EXPECT_TRUE(has_bitvector && vec.getIsFilter()); - numHits = postingList.getBitVectorEntry(find_result.second)->_bv->reader().countTrueBits(); + numHits = posting_store.getBitVectorEntry(find_result.second)->_bv->reader().countTrueBits(); } if (has_bitvector) { uint32_t doc = docBegin; uint32_t bv_num_hits = 0; - auto& bv = postingList.getBitVectorEntry(find_result.second)->_bv->reader(); + auto& bv = posting_store.getBitVectorEntry(find_result.second)->_bv->reader(); for (auto lid = bv.getFirstTrueBit(); lid < bv.size(); lid = bv.getNextTrueBit(lid + 1)) { EXPECT_EQ(doc++, lid); ++bv_num_hits; @@ -701,12 +700,11 @@ PostingListAttributeTest::checkPostingList(AttributeType & vec, ValueType value, { const typename AttributeType::EnumStore & enumStore = vec.getEnumStore(); auto& dict = enumStore.get_dictionary(); - const typename AttributeType::PostingList & postingList = vec.getPostingList(); + const auto& posting_store = vec.get_posting_store(); auto find_result = dict.find_posting_list(vec.getEnumStore().make_comparator(value), dict.get_frozen_root()); ASSERT_TRUE(find_result.first.valid()); - typename AttributeType::PostingList::Iterator postings; - postings = postingList.begin(find_result.second); + auto postings = posting_store.begin(find_result.second); DocSet::iterator docBegin = expected.begin(); DocSet::iterator docEnd = expected.end(); diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h index 09388d6d44c..2d0b8cbd733 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h @@ -61,13 +61,13 @@ private: using DocIndices = typename MultiValueNumericEnumAttribute<B, M>::DocIndices; using FrozenDictionary = typename Dictionary::FrozenView; using Posting = typename PostingParent::Posting; - using PostingList = typename PostingParent::PostingList; + using PostingStore = typename PostingParent::PostingStore; using PostingMap = typename PostingParent::PostingMap; using QueryTermSimpleUP = AttributeVector::QueryTermSimpleUP; using WeightedIndex = typename MultiValueNumericEnumAttribute<B, M>::WeightedIndex; using generation_t = typename MultiValueNumericEnumAttribute<B, M>::generation_t; - using PostingParent::_postingList; + using PostingParent::_posting_store; using PostingParent::clearAllPostings; using PostingParent::handle_load_posting_lists; using PostingParent::handle_load_posting_lists_and_update_enum_store; diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp index 38e464f207a..53c183a6987 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp @@ -21,7 +21,7 @@ void MultiValueNumericPostingAttribute<B, M>::mergeMemoryStats(vespalib::MemoryUsage & total) { auto& compaction_strategy = this->getConfig().getCompactionStrategy(); - total.merge(this->getPostingList().update_stat(compaction_strategy)); + total.merge(this->get_posting_store().update_stat(compaction_strategy)); } template <typename B, typename M> @@ -60,16 +60,16 @@ void MultiValueNumericPostingAttribute<B, M>::reclaim_memory(generation_t oldest_used_gen) { MultiValueNumericEnumAttribute<B, M>::reclaim_memory(oldest_used_gen); - _postingList.reclaim_memory(oldest_used_gen); + _posting_store.reclaim_memory(oldest_used_gen); } template <typename B, typename M> void MultiValueNumericPostingAttribute<B, M>::before_inc_generation(generation_t current_gen) { - _postingList.freeze(); + _posting_store.freeze(); MultiValueNumericEnumAttribute<B, M>::before_inc_generation(current_gen); - _postingList.assign_generation(current_gen); + _posting_store.assign_generation(current_gen); } template <typename B, typename M> @@ -106,9 +106,9 @@ MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::lookup( if (find_result.first.valid()) { auto pidx = find_result.second; if (pidx.valid()) { - const PostingList &plist = self.getPostingList(); - auto minmax = plist.getAggregated(pidx); - return LookupResult(pidx, plist.frozenSize(pidx), minmax.getMin(), minmax.getMax(), find_result.first); + const auto& store = self.get_posting_store(); + auto minmax = store.getAggregated(pidx); + return LookupResult(pidx, store.frozenSize(pidx), minmax.getMin(), minmax.getMax(), find_result.first); } } return LookupResult(); @@ -127,7 +127,7 @@ void MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::create(vespalib::datastore::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const { assert(idx.valid()); - self.getPostingList().beginFrozen(idx, dst); + self.get_posting_store().beginFrozen(idx, dst); } template <typename B, typename M> @@ -135,21 +135,21 @@ DocumentWeightIterator MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::create(vespalib::datastore::EntryRef idx) const { assert(idx.valid()); - return self.getPostingList().beginFrozen(idx); + return self.get_posting_store().beginFrozen(idx); } template <typename B, typename M> std::unique_ptr<queryeval::SearchIterator> MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::make_bitvector_iterator(vespalib::datastore::EntryRef idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const { - return self.getPostingList().make_bitvector_iterator(idx, doc_id_limit, match_data, strict); + return self.get_posting_store().make_bitvector_iterator(idx, doc_id_limit, match_data, strict); } template <typename B, typename M> bool MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::has_weight_iterator(vespalib::datastore::EntryRef idx) const noexcept { - return self.getPostingList().has_btree(idx); + return self.get_posting_store().has_btree(idx); } template <typename B, typename M> diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h index 9ecfa93e5ec..67f4f25ac5b 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h @@ -59,7 +59,7 @@ private: using WeightedIndex = typename MultiValueStringAttributeT<B, T>::WeightedIndex; using generation_t = typename MultiValueStringAttributeT<B, T>::generation_t; - using PostingParent::_postingList; + using PostingParent::_posting_store; using PostingParent::clearAllPostings; using PostingParent::handle_load_posting_lists; using PostingParent::handle_load_posting_lists_and_update_enum_store; @@ -70,9 +70,9 @@ private: void applyValueChanges(const DocIndices& docIndices, EnumStoreBatchUpdater& updater) override ; public: - using PostingParent::getPostingList; + using PostingParent::get_posting_store; using Dictionary = EnumPostingTree; - using PostingList = typename PostingParent::PostingList; + using PostingStore = typename PostingParent::PostingStore; MultiValueStringPostingAttributeT(const vespalib::string & name, const AttributeVector::Config & c); MultiValueStringPostingAttributeT(const vespalib::string & name); diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp index 7c162d32c1f..5d4f140b96c 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp @@ -69,7 +69,7 @@ void MultiValueStringPostingAttributeT<B, T>::mergeMemoryStats(vespalib::MemoryUsage &total) { auto& compaction_strategy = this->getConfig().getCompactionStrategy(); - total.merge(this->_postingList.update_stat(compaction_strategy)); + total.merge(this->_posting_store.update_stat(compaction_strategy)); } template <typename B, typename T> @@ -77,16 +77,16 @@ void MultiValueStringPostingAttributeT<B, T>::reclaim_memory(generation_t oldest_used_gen) { MultiValueStringAttributeT<B, T>::reclaim_memory(oldest_used_gen); - _postingList.reclaim_memory(oldest_used_gen); + _posting_store.reclaim_memory(oldest_used_gen); } template <typename B, typename T> void MultiValueStringPostingAttributeT<B, T>::before_inc_generation(generation_t current_gen) { - _postingList.freeze(); + _posting_store.freeze(); MultiValueStringAttributeT<B, T>::before_inc_generation(current_gen); - _postingList.assign_generation(current_gen); + _posting_store.assign_generation(current_gen); } @@ -126,9 +126,9 @@ MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::lookup( if (find_result.first.valid()) { auto pidx = find_result.second; if (pidx.valid()) { - const PostingList &plist = self.getPostingList(); - auto minmax = plist.getAggregated(pidx); - return LookupResult(pidx, plist.frozenSize(pidx), minmax.getMin(), minmax.getMax(), find_result.first); + const auto& store = self.get_posting_store(); + auto minmax = store.getAggregated(pidx); + return LookupResult(pidx, store.frozenSize(pidx), minmax.getMin(), minmax.getMax(), find_result.first); } } return LookupResult(); @@ -147,7 +147,7 @@ void MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::create(vespalib::datastore::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const { assert(idx.valid()); - self.getPostingList().beginFrozen(idx, dst); + self.get_posting_store().beginFrozen(idx, dst); } template <typename B, typename M> @@ -155,21 +155,21 @@ DocumentWeightIterator MultiValueStringPostingAttributeT<B, M>::DocumentWeightAttributeAdapter::create(vespalib::datastore::EntryRef idx) const { assert(idx.valid()); - return self.getPostingList().beginFrozen(idx); + return self.get_posting_store().beginFrozen(idx); } template <typename B, typename M> bool MultiValueStringPostingAttributeT<B, M>::DocumentWeightAttributeAdapter::has_weight_iterator(vespalib::datastore::EntryRef idx) const noexcept { - return self.getPostingList().has_btree(idx); + return self.get_posting_store().has_btree(idx); } template <typename B, typename M> std::unique_ptr<queryeval::SearchIterator> MultiValueStringPostingAttributeT<B, M>::DocumentWeightAttributeAdapter::make_bitvector_iterator(vespalib::datastore::EntryRef idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const { - return self.getPostingList().make_bitvector_iterator(idx, doc_id_limit, match_data, strict); + return self.get_posting_store().make_bitvector_iterator(idx, doc_id_limit, match_data, strict); } template <typename B, typename T> diff --git a/searchlib/src/vespa/searchlib/attribute/posting_list_traverser.h b/searchlib/src/vespa/searchlib/attribute/posting_list_traverser.h index 8f350f34c35..bc792b68a88 100644 --- a/searchlib/src/vespa/searchlib/attribute/posting_list_traverser.h +++ b/searchlib/src/vespa/searchlib/attribute/posting_list_traverser.h @@ -5,18 +5,17 @@ namespace search::attribute { /* - * Class used to traverse a posting list and call the functor for each - * lid. + * Class used to traverse a posting list and call the functor for each lid. */ -template <typename PostingList> +template <typename PostingStore> class PostingListTraverser { using EntryRef = vespalib::datastore::EntryRef; - const PostingList &_postingList; + const PostingStore &_posting_store; EntryRef _pidx; public: - PostingListTraverser(const PostingList &postingList, EntryRef pidx) - : _postingList(postingList), + PostingListTraverser(const PostingStore &posting_store, EntryRef pidx) + : _posting_store(posting_store), _pidx(pidx) { } @@ -25,13 +24,13 @@ public: template <typename Func> void foreach(Func func) const { - _postingList.foreach_frozen(_pidx, func); + _posting_store.foreach_frozen(_pidx, func); } template <typename Func> void foreach_key(Func func) const { - _postingList.foreach_frozen_key(_pidx, func); + _posting_store.foreach_frozen_key(_pidx, func); } }; diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp index 4e88fb96c7e..d3f9c3f5d82 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp @@ -15,8 +15,8 @@ PostingListAttributeBase<P>:: PostingListAttributeBase(AttributeVector &attr, IEnumStore &enumStore) : attribute::IPostingListAttributeBase(), - _postingList(enumStore.get_dictionary(), attr.getStatus(), - attr.getConfig()), + _posting_store(enumStore.get_dictionary(), attr.getStatus(), + attr.getConfig()), _attr(attr), _dictionary(enumStore.get_dictionary()) { } @@ -28,11 +28,11 @@ template <typename P> void PostingListAttributeBase<P>::clearAllPostings() { - _postingList.clearBuilder(); + _posting_store.clearBuilder(); _attr.incGeneration(); // Force freeze auto clearer = [this](EntryRef posting_idx) { - _postingList.clear(posting_idx); + _posting_store.clear(posting_idx); }; _dictionary.clear_all_posting_lists(clearer); _attr.incGeneration(); // Force freeze @@ -69,7 +69,7 @@ PostingListAttributeBase<P>::handle_load_posting_lists_and_update_enum_store(enu if (loader.is_folded_change(enum_indexes[posting_enum], enum_indexes[preve])) { postings.removeDups(); newIndex = EntryRef(); - _postingList.apply(newIndex, + _posting_store.apply(newIndex, postings._additions.data(), postings._additions.data() + postings._additions.size(), @@ -91,7 +91,7 @@ PostingListAttributeBase<P>::handle_load_posting_lists_and_update_enum_store(enu loader.set_ref_count(enum_indexes[preve], refCount); postings.removeDups(); newIndex = EntryRef(); - _postingList.apply(newIndex, + _posting_store.apply(newIndex, postings._additions.data(), postings._additions.data() + postings._additions.size(), postings._removals.data(), @@ -112,7 +112,7 @@ PostingListAttributeBase<P>::updatePostings(PostingMap &changePost, change.removeDups(); auto updater= [this, &change](EntryRef posting_idx) -> EntryRef { - _postingList.apply(posting_idx, + _posting_store.apply(posting_idx, change._additions.data(), change._additions.data() + change._additions.size(), change._removals.data(), @@ -135,7 +135,7 @@ PostingListAttributeBase<P>::forwardedOnAddDoc(DocId doc, if (doc >= wantCapacity) { wantCapacity = doc + 1; } - return _postingList.resizeBitVectors(wantSize, wantCapacity); + return _posting_store.resizeBitVectors(wantSize, wantCapacity); } template <typename P> @@ -155,7 +155,7 @@ clearPostings(attribute::IAttributeVector::EnumHandle eidx, EntryRef er(eidx); auto updater = [this, &postings](EntryRef posting_idx) -> EntryRef { - _postingList.apply(posting_idx, + _posting_store.apply(posting_idx, postings._additions.data(), postings._additions.data() + postings._additions.size(), postings._removals.data(), @@ -169,28 +169,28 @@ template <typename P> void PostingListAttributeBase<P>::forwardedShrinkLidSpace(uint32_t newSize) { - (void) _postingList.resizeBitVectors(newSize, newSize); + (void) _posting_store.resizeBitVectors(newSize, newSize); } template <typename P> attribute::PostingStoreMemoryUsage PostingListAttributeBase<P>::getMemoryUsage() const { - return _postingList.getMemoryUsage(); + return _posting_store.getMemoryUsage(); } template <typename P> bool PostingListAttributeBase<P>::consider_compact_worst_btree_nodes(const CompactionStrategy& compaction_strategy) { - return _postingList.consider_compact_worst_btree_nodes(compaction_strategy); + return _posting_store.consider_compact_worst_btree_nodes(compaction_strategy); } template <typename P> bool PostingListAttributeBase<P>::consider_compact_worst_buffers(const CompactionStrategy& compaction_strategy) { - return _postingList.consider_compact_worst_buffers(compaction_strategy); + return _posting_store.consider_compact_worst_buffers(compaction_strategy); } template <typename P, typename LoadedVector, typename LoadedValueType, @@ -219,7 +219,7 @@ handle_load_posting_lists(LoadedVector& loaded) EntryRef newIndex; PostingChange<P> postings; uint32_t docIdLimit = _attr.getNumDocs(); - _postingList.resizeBitVectors(docIdLimit, docIdLimit); + _posting_store.resizeBitVectors(docIdLimit, docIdLimit); if ( ! loaded.empty() ) { vespalib::Array<typename LoadedVector::Type> similarValues; auto value = loaded.read(); @@ -237,7 +237,7 @@ handle_load_posting_lists(LoadedVector& loaded) } else { postings.removeDups(); newIndex = EntryRef(); - _postingList.apply(newIndex, + _posting_store.apply(newIndex, postings._additions.data(), postings._additions.data() + postings._additions.size(), @@ -259,7 +259,7 @@ handle_load_posting_lists(LoadedVector& loaded) } postings.removeDups(); newIndex = EntryRef(); - _postingList.apply(newIndex, + _posting_store.apply(newIndex, postings._additions.data(), postings._additions.data() + postings._additions.size(), diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h index 3987d661d26..e2be0d69434 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h @@ -43,10 +43,10 @@ protected: using DocId = AttributeVector::DocId; using EntryRef = vespalib::datastore::EntryRef; using EnumIndex = IEnumStore::Index; - using PostingList = typename AggregationTraits::PostingList; + using PostingStore = typename AggregationTraits::PostingStoreType; using PostingMap = std::map<EnumPostingPair, PostingChange<P> >; - PostingList _postingList; + PostingStore _posting_store; AttributeVector &_attr; IEnumStoreDictionary& _dictionary; @@ -57,8 +57,8 @@ protected: void updatePostings(PostingMap &changePost, const vespalib::datastore::EntryComparator &cmp); void clearAllPostings(); - void disableFreeLists() { _postingList.disableFreeLists(); } - void disable_entry_hold_list() { _postingList.disable_entry_hold_list(); } + void disableFreeLists() { _posting_store.disableFreeLists(); } + void disable_entry_hold_list() { _posting_store.disable_entry_hold_list(); } void handle_load_posting_lists_and_update_enum_store(enumstore::EnumeratedPostingsLoader& loader); bool forwardedOnAddDoc(DocId doc, size_t wantSize, size_t wantCapacity); @@ -71,8 +71,8 @@ protected: bool consider_compact_worst_buffers(const CompactionStrategy& compaction_strategy) override; public: - const PostingList & getPostingList() const { return _postingList; } - PostingList & getPostingList() { return _postingList; } + const PostingStore & get_posting_store() const { return _posting_store; } + PostingStore & get_posting_store() { return _posting_store; } }; template <typename P, typename LoadedVector, typename LoadedValueType, @@ -86,14 +86,14 @@ public: using EnumIndex = IEnumStore::Index; using EnumStore = EnumStoreType; using ComparatorType = typename EnumStore::ComparatorType; - using PostingList = typename Parent::PostingList; + using PostingStore = typename Parent::PostingStore; using PostingMap = typename Parent::PostingMap; using Parent::clearAllPostings; using Parent::updatePostings; using Parent::handle_load_posting_lists_and_update_enum_store; using Parent::clearPostings; - using Parent::_postingList; + using Parent::_posting_store; using Parent::_attr; using Parent::_dictionary; diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h index f45f8f2245e..e4d0aeeccb0 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h +++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h @@ -82,20 +82,20 @@ class PostingListSearchContextT : public PostingListSearchContext protected: using DataType = DataT; using Traits = PostingListTraits<DataType>; - using PostingList = typename Traits::PostingList; + using PostingStore = typename Traits::PostingStoreType; using Posting = typename Traits::Posting; using AtomicEntryRef = vespalib::datastore::AtomicEntryRef; using EntryRef = vespalib::datastore::EntryRef; - using FrozenView = typename PostingList::BTreeType::FrozenView; + using FrozenView = typename PostingStore::BTreeType::FrozenView; - const PostingList &_postingList; + const PostingStore& _posting_store; /* * Synthetic posting lists for range search, in array or bitvector form */ PostingListMerger<DataT> _merger; PostingListSearchContextT(const IEnumStoreDictionary& dictionary, uint32_t docIdLimit, uint64_t numValues, - bool hasWeight, const PostingList &postingList, + bool hasWeight, const PostingStore& posting_store, bool useBitVector, const ISearchContext &baseSearchCtx); ~PostingListSearchContextT() override; @@ -128,11 +128,11 @@ protected: using Dictionary = typename Parent::Dictionary; using DictionaryConstIterator = Dictionary::ConstIterator; using EntryRef = vespalib::datastore::EntryRef; - using PostingList = typename Parent::PostingList; + using PostingStore = typename Parent::PostingStore; using Parent::_docIdLimit; using Parent::_lowerDictItr; using Parent::_merger; - using Parent::_postingList; + using Parent::_posting_store; using Parent::_uniqueValues; using Parent::_upperDictItr; using Parent::singleHits; @@ -142,7 +142,7 @@ protected: mutable std::vector<EntryRef> _posting_indexes; PostingListFoldedSearchContextT(const IEnumStoreDictionary& dictionary, uint32_t docIdLimit, uint64_t numValues, - bool hasWeight, const PostingList &postingList, + bool hasWeight, const PostingStore& posting_store, bool useBitVector, const ISearchContext &baseSearchCtx); ~PostingListFoldedSearchContextT() override; @@ -242,7 +242,7 @@ PostingSearchContext(BaseSC&& base_sc, bool useBitVector, const AttrT &toBeSearc toBeSearched.getCommittedDocIdLimit(), toBeSearched.getStatus().getNumValues(), toBeSearched.hasWeightedSetType(), - toBeSearched.getPostingList(), + toBeSearched.get_posting_store(), useBitVector, *this), _toBeSearched(toBeSearched), @@ -454,7 +454,7 @@ NumericPostingSearchContext<BaseSC, AttrT, DataT>::calc_estimated_hits_in_range( constexpr uint32_t max_posting_lists_to_count = 1000; auto it = this->_lowerDictItr; for (uint32_t count = 0; (it != this->_upperDictItr) && (count < max_posting_lists_to_count); ++it, ++count) { - exact_sum += this->_postingList.frozenSize(it.getData().load_acquire()); + exact_sum += this->_posting_store.frozenSize(it.getData().load_acquire()); } if (it != this->_upperDictItr) { uint32_t remaining_posting_lists = this->_upperDictItr - it; diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp index cc12b1f7825..5476ddd1793 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp +++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp @@ -21,9 +21,9 @@ namespace search::attribute { template <typename DataT> PostingListSearchContextT<DataT>:: PostingListSearchContextT(const IEnumStoreDictionary& dictionary, uint32_t docIdLimit, uint64_t numValues, bool hasWeight, - const PostingList &postingList, bool useBitVector, const ISearchContext &searchContext) + const PostingStore& posting_store, bool useBitVector, const ISearchContext &searchContext) : PostingListSearchContext(dictionary, dictionary.get_has_btree_dictionary(), docIdLimit, numValues, hasWeight, useBitVector, searchContext), - _postingList(postingList), + _posting_store(posting_store), _merger(docIdLimit) { } @@ -39,16 +39,16 @@ PostingListSearchContextT<DataT>::lookupSingle() PostingListSearchContext::lookupSingle(); if (!_pidx.valid()) return; - uint32_t typeId = _postingList.getTypeId(_pidx); - if (!_postingList.isSmallArray(typeId)) { - if (_postingList.isBitVector(typeId)) { - const BitVectorEntry *bve = _postingList.getBitVectorEntry(_pidx); + uint32_t typeId = _posting_store.getTypeId(_pidx); + if (!_posting_store.isSmallArray(typeId)) { + if (_posting_store.isBitVector(typeId)) { + const BitVectorEntry *bve = _posting_store.getBitVectorEntry(_pidx); const GrowableBitVector *bv = bve->_bv.get(); _bv = &bv->reader(); _pidx = bve->_tree; } if (_pidx.valid()) { - auto frozenView = _postingList.getTreeEntry(_pidx)->getFrozenView(_postingList.getAllocator()); + auto frozenView = _posting_store.getTreeEntry(_pidx)->getFrozenView(_posting_store.getAllocator()); _frozenRoot = frozenView.getRoot(); if (!_frozenRoot.valid()) { _pidx = vespalib::datastore::EntryRef(); @@ -62,7 +62,7 @@ void PostingListSearchContextT<DataT>::fillArray() { for (auto it(_lowerDictItr); it != _upperDictItr; ++it) { - _merger.addToArray(PostingListTraverser<PostingList>(_postingList, + _merger.addToArray(PostingListTraverser<PostingStore>(_posting_store, it.getData().load_acquire())); } _merger.merge(); @@ -73,8 +73,8 @@ void PostingListSearchContextT<DataT>::fillBitVector() { for (auto it(_lowerDictItr); it != _upperDictItr; ++it) { - _merger.addToBitVector(PostingListTraverser<PostingList>(_postingList, - it.getData().load_acquire())); + _merger.addToBitVector(PostingListTraverser<PostingStore>(_posting_store, + it.getData().load_acquire())); } } @@ -134,10 +134,10 @@ PostingListSearchContextT<DataT>::diversify(bool forward, size_t wanted_hits, co if (!_merger.merge_done()) { _merger.reserveArray(128, wanted_hits); if (_uniqueValues == 1u && !_lowerDictItr.valid() && _pidx.valid()) { - diversity::diversify_single(_pidx, _postingList, wanted_hits, diversity_attr, + diversity::diversify_single(_pidx, _posting_store, wanted_hits, diversity_attr, max_per_group, cutoff_groups, cutoff_strict, _merger.getWritableArray(), _merger.getWritableStartPos()); } else { - diversity::diversify(forward, _lowerDictItr, _upperDictItr, _postingList, wanted_hits, diversity_attr, + diversity::diversify(forward, _lowerDictItr, _upperDictItr, _posting_store, wanted_hits, diversity_attr, max_per_group, cutoff_groups, cutoff_strict, _merger.getWritableArray(), _merger.getWritableStartPos()); } _merger.merge(); @@ -160,7 +160,7 @@ createPostingIterator(fef::TermFieldMatchData *matchData, bool strict) DocIt postings; vespalib::ConstArrayRef<Posting> array = _merger.getArray(); postings.set(&array[0], &array[array.size()]); - if (_postingList.isFilter()) { + if (_posting_store.isFilter()) { return std::make_unique<FilterAttributePostingListIteratorT<DocIt>>(_baseSearchCtx, matchData, postings); } else { return std::make_unique<AttributePostingListIteratorT<DocIt>>(_baseSearchCtx, _hasWeight, matchData, postings); @@ -180,24 +180,23 @@ createPostingIterator(fef::TermFieldMatchData *matchData, bool strict) if (!_pidx.valid()) { return std::make_unique<EmptySearch>(); } - const PostingList &postingList = _postingList; if (!_frozenRoot.valid()) { - uint32_t clusterSize = _postingList.getClusterSize(_pidx); + uint32_t clusterSize = _posting_store.getClusterSize(_pidx); assert(clusterSize != 0); using DocIt = DocIdMinMaxIterator<Posting>; DocIt postings; - const Posting *array = postingList.getKeyDataEntry(_pidx, clusterSize); + const Posting *array = _posting_store.getKeyDataEntry(_pidx, clusterSize); postings.set(array, array + clusterSize); - if (postingList.isFilter()) { + if (_posting_store.isFilter()) { return std::make_unique<FilterAttributePostingListIteratorT<DocIt>>(_baseSearchCtx, matchData, postings); } else { return std::make_unique<AttributePostingListIteratorT<DocIt>>(_baseSearchCtx, _hasWeight, matchData, postings); } } - typename PostingList::BTreeType::FrozenView frozen(_frozenRoot, postingList.getAllocator()); + typename PostingStore::BTreeType::FrozenView frozen(_frozenRoot, _posting_store.getAllocator()); - using DocIt = typename PostingList::ConstIterator; - if (_postingList.isFilter()) { + using DocIt = typename PostingStore::ConstIterator; + if (_posting_store.isFilter()) { return std::make_unique<FilterAttributePostingListIteratorT<DocIt>>(_baseSearchCtx, matchData, frozen.getRoot(), frozen.getAllocator()); } else { return std::make_unique<AttributePostingListIteratorT<DocIt>> (_baseSearchCtx, _hasWeight, matchData, frozen.getRoot(), frozen.getAllocator()); @@ -220,9 +219,9 @@ PostingListSearchContextT<DataT>::singleHits() const return 0u; } if (!_frozenRoot.valid()) { - return _postingList.getClusterSize(_pidx); + return _posting_store.getClusterSize(_pidx); } - typename PostingList::BTreeType::FrozenView frozenView(_frozenRoot, _postingList.getAllocator()); + typename PostingStore::BTreeType::FrozenView frozenView(_frozenRoot, _posting_store.getAllocator()); return frozenView.size(); } @@ -249,7 +248,7 @@ PostingListSearchContextT<DataT>::applyRangeLimit(int rangeLimit) if (rangeLimit > 0) { DictionaryConstIterator middle = _lowerDictItr; for (int n(0); (n < rangeLimit) && (middle != _upperDictItr); ++middle) { - n += _postingList.frozenSize(middle.getData().load_acquire()); + n += _posting_store.frozenSize(middle.getData().load_acquire()); } _upperDictItr = middle; _uniqueValues = _upperDictItr - _lowerDictItr; @@ -258,7 +257,7 @@ PostingListSearchContextT<DataT>::applyRangeLimit(int rangeLimit) DictionaryConstIterator middle = _upperDictItr; for (int n(0); (n < rangeLimit) && (middle != _lowerDictItr); ) { --middle; - n += _postingList.frozenSize(middle.getData().load_acquire()); + n += _posting_store.frozenSize(middle.getData().load_acquire()); } _lowerDictItr = middle; _uniqueValues = _upperDictItr - _lowerDictItr; @@ -269,9 +268,9 @@ PostingListSearchContextT<DataT>::applyRangeLimit(int rangeLimit) template <typename DataT> PostingListFoldedSearchContextT<DataT>:: PostingListFoldedSearchContextT(const IEnumStoreDictionary& dictionary, uint32_t docIdLimit, uint64_t numValues, - bool hasWeight, const PostingList &postingList, + bool hasWeight, const PostingStore& posting_store, bool useBitVector, const ISearchContext &searchContext) - : Parent(dictionary, docIdLimit, numValues, hasWeight, postingList, useBitVector, searchContext), + : Parent(dictionary, docIdLimit, numValues, hasWeight, posting_store, useBitVector, searchContext), _resume_scan_itr(), _posting_indexes() { @@ -290,7 +289,7 @@ PostingListFoldedSearchContextT<DataT>::calc_estimated_hits_in_range() const if (use_dictionary_entry(it)) { auto pidx = it.getData().load_acquire(); if (pidx.valid()) { - sum += _postingList.frozenSize(pidx); + sum += _posting_store.frozenSize(pidx); if (!overflow) { if (_posting_indexes.size() < MAX_POSTING_INDEXES_SIZE) { _posting_indexes.emplace_back(pidx); @@ -312,9 +311,9 @@ void PostingListFoldedSearchContextT<DataT>::fill_array_or_bitvector_helper(EntryRef pidx) { if constexpr (fill_array) { - _merger.addToArray(PostingListTraverser<PostingList>(_postingList, pidx)); + _merger.addToArray(PostingListTraverser<PostingStore>(_posting_store, pidx)); } else { - _merger.addToBitVector(PostingListTraverser<PostingList>(_postingList, pidx)); + _merger.addToBitVector(PostingListTraverser<PostingStore>(_posting_store, pidx)); } } diff --git a/searchlib/src/vespa/searchlib/attribute/postinglisttraits.h b/searchlib/src/vespa/searchlib/attribute/postinglisttraits.h index 928ecc7aaf1..9a1432a6d77 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglisttraits.h +++ b/searchlib/src/vespa/searchlib/attribute/postinglisttraits.h @@ -19,7 +19,7 @@ public: using AggrCalcType = vespalib::btree::NoAggrCalc; using const_iterator = vespalib::btree::BTreeConstIterator<uint32_t, vespalib::btree::BTreeNoLeafData, AggregatedType, std::less<uint32_t>, BTreeTraits >; using PostingStoreBase = vespalib::btree::BTreeStore<uint32_t, vespalib::btree::BTreeNoLeafData, AggregatedType, std::less<uint32_t>, BTreeTraits, AggrCalcType> ; - using PostingList = PostingStore<vespalib::btree::BTreeNoLeafData>; + using PostingStoreType = PostingStore<vespalib::btree::BTreeNoLeafData>; using Posting = PostingStoreBase::KeyDataType; }; @@ -33,7 +33,7 @@ public: using AggrCalcType = vespalib::btree::MinMaxAggrCalc; using const_iterator = vespalib::btree::BTreeConstIterator<uint32_t, int32_t, AggregatedType, std::less<uint32_t>, BTreeTraits >; using PostingStoreBase = vespalib::btree::BTreeStore<uint32_t, int32_t, AggregatedType, std::less<uint32_t>, BTreeTraits, AggrCalcType>; - using PostingList = PostingStore<int32_t>; + using PostingStoreType = PostingStore<int32_t>; using Posting = PostingStoreBase::KeyDataType; }; diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.h b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.h index 8a187014add..fd055206a86 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.h @@ -49,7 +49,7 @@ private: using ValueModifier = typename B::BaseClass::ValueModifier; using generation_t = typename SingleValueNumericEnumAttribute<B>::generation_t; - using PostingParent::_postingList; + using PostingParent::_posting_store; using PostingParent::clearAllPostings; using PostingParent::handle_load_posting_lists; using PostingParent::handle_load_posting_lists_and_update_enum_store; diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp index 1aee447760d..6e9c6a73337 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp @@ -37,7 +37,7 @@ void SingleValueNumericPostingAttribute<B>::mergeMemoryStats(vespalib::MemoryUsage & total) { auto& compaction_strategy = this->getConfig().getCompactionStrategy(); - total.merge(this->_postingList.update_stat(compaction_strategy)); + total.merge(this->_posting_store.update_stat(compaction_strategy)); } template <typename B> @@ -124,16 +124,16 @@ void SingleValueNumericPostingAttribute<B>::reclaim_memory(generation_t oldest_used_gen) { SingleValueNumericEnumAttribute<B>::reclaim_memory(oldest_used_gen); - _postingList.reclaim_memory(oldest_used_gen); + _posting_store.reclaim_memory(oldest_used_gen); } template <typename B> void SingleValueNumericPostingAttribute<B>::before_inc_generation(generation_t current_gen) { - _postingList.freeze(); + _posting_store.freeze(); SingleValueNumericEnumAttribute<B>::before_inc_generation(current_gen); - _postingList.assign_generation(current_gen); + _posting_store.assign_generation(current_gen); } template <typename B> diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h index 8a204a2d46b..543cfdd90ec 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h @@ -43,15 +43,15 @@ private: using ValueModifier = typename SingleValueStringAttributeT<B>::ValueModifier; using generation_t = typename SingleValueStringAttributeT<B>::generation_t; - using PostingParent::_postingList; + using PostingParent::_posting_store; using PostingParent::clearAllPostings; using PostingParent::handle_load_posting_lists; using PostingParent::handle_load_posting_lists_and_update_enum_store; using PostingParent::forwardedOnAddDoc; public: - using PostingList = typename PostingParent::PostingList; + using PostingStore = typename PostingParent::PostingStore; using Dictionary = EnumPostingTree; - using PostingParent::getPostingList; + using PostingParent::get_posting_store; private: void freezeEnumDictionary() override; diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp index 72eae570efc..85b0c095d76 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp @@ -43,7 +43,7 @@ void SingleValueStringPostingAttributeT<B>::mergeMemoryStats(vespalib::MemoryUsage & total) { auto& compaction_strategy = this->getConfig().getCompactionStrategy(); - total.merge(this->_postingList.update_stat(compaction_strategy)); + total.merge(this->_posting_store.update_stat(compaction_strategy)); } template <typename B> @@ -125,16 +125,16 @@ void SingleValueStringPostingAttributeT<B>::reclaim_memory(generation_t oldest_used_gen) { SingleValueStringAttributeT<B>::reclaim_memory(oldest_used_gen); - _postingList.reclaim_memory(oldest_used_gen); + _posting_store.reclaim_memory(oldest_used_gen); } template <typename B> void SingleValueStringPostingAttributeT<B>::before_inc_generation(generation_t current_gen) { - _postingList.freeze(); + _posting_store.freeze(); SingleValueStringAttributeT<B>::before_inc_generation(current_gen); - _postingList.assign_generation(current_gen); + _posting_store.assign_generation(current_gen); } template <typename B> |