// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "multinumericpostattribute.h" #include "multi_numeric_enum_search_context.h" #include "numeric_direct_posting_store_adapter.hpp" #include #include namespace search { template void MultiValueNumericPostingAttribute::freezeEnumDictionary() { this->getEnumStore().freeze_dictionary(); } template void MultiValueNumericPostingAttribute::mergeMemoryStats(vespalib::MemoryUsage & total) { auto& compaction_strategy = this->getConfig().getCompactionStrategy(); total.merge(this->get_posting_store().update_stat(compaction_strategy)); } template void MultiValueNumericPostingAttribute::applyValueChanges(const DocIndices& docIndices, EnumStoreBatchUpdater& updater) { using PostingChangeComputer = PostingChangeComputerT; EnumIndexMapper mapper; PostingMap changePost(PostingChangeComputer::compute(this->getMultiValueMapping(), docIndices, this->getEnumStore().get_comparator(), mapper)); this->updatePostings(changePost); MultiValueNumericEnumAttribute::applyValueChanges(docIndices, updater); } template MultiValueNumericPostingAttribute::MultiValueNumericPostingAttribute(const vespalib::string & name, const AttributeVector::Config & cfg) : MultiValueNumericEnumAttribute(name, cfg), PostingParent(*this, this->getEnumStore()), _posting_store_adapter(this->get_posting_store(), this->_enumStore, this->getIsFilter()) { } template MultiValueNumericPostingAttribute::~MultiValueNumericPostingAttribute() { this->disableFreeLists(); this->disable_entry_hold_list(); clearAllPostings(); } template void MultiValueNumericPostingAttribute::reclaim_memory(generation_t oldest_used_gen) { MultiValueNumericEnumAttribute::reclaim_memory(oldest_used_gen); _posting_store.reclaim_memory(oldest_used_gen); } template void MultiValueNumericPostingAttribute::before_inc_generation(generation_t current_gen) { _posting_store.freeze(); MultiValueNumericEnumAttribute::before_inc_generation(current_gen); _posting_store.assign_generation(current_gen); } template std::unique_ptr MultiValueNumericPostingAttribute::getSearch(QueryTermSimpleUP qTerm, const attribute::SearchContextParams & params) const { using BaseSC = attribute::MultiNumericEnumSearchContext; using SC = attribute::NumericPostingSearchContext; auto doc_id_limit = this->getCommittedDocIdLimit(); BaseSC base_sc(std::move(qTerm), *this, this->_mvMapping.make_read_view(doc_id_limit), this->_enumStore); return std::make_unique(std::move(base_sc), params, *this); } template const IDocidWithWeightPostingStore* MultiValueNumericPostingAttribute::as_docid_with_weight_posting_store() const { if (this->getConfig().basicType().is_integer_type()) { return &_posting_store_adapter; } return nullptr; } }