// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "multienumattribute.hpp" #include "enumattribute.h" #include "enummodifier.h" #include "floatbase.h" #include "integerbase.h" #include "stringbase.h" #include #include namespace search { template class MultiValueEnumAttribute, vespalib::datastore::AtomicEntryRef>; template class MultiValueEnumAttribute>, vespalib::datastore::AtomicEntryRef>; template class MultiValueEnumAttribute>, vespalib::datastore::AtomicEntryRef>; template class MultiValueEnumAttribute>, vespalib::datastore::AtomicEntryRef>; template class MultiValueEnumAttribute>, vespalib::datastore::AtomicEntryRef>; template class MultiValueEnumAttribute>, vespalib::datastore::AtomicEntryRef>; template class MultiValueEnumAttribute>, vespalib::datastore::AtomicEntryRef>; template class MultiValueEnumAttribute, multivalue::WeightedValue>; template class MultiValueEnumAttribute>, multivalue::WeightedValue>; template class MultiValueEnumAttribute>, multivalue::WeightedValue>; template class MultiValueEnumAttribute>, multivalue::WeightedValue>; template class MultiValueEnumAttribute>, multivalue::WeightedValue>; template class MultiValueEnumAttribute>, multivalue::WeightedValue>; template class MultiValueEnumAttribute>, multivalue::WeightedValue>; } namespace search::multienumattribute { using EnumIndex = IEnumStore::Index; using EnumIndexRemapper = IEnumStore::EnumIndexRemapper; using Value = vespalib::datastore::AtomicEntryRef; using WeightedValue = multivalue::WeightedValue; template void remap_enum_store_refs(const EnumIndexRemapper& remapper, AttributeVector& v, attribute::MultiValueMapping& multi_value_mapping) { // update multi_value_mapping with new EnumIndex values after enum store has been compacted. v.logEnumStoreEvent("compactfixup", "drain"); { attribute::EnumModifier enum_guard(v.getEnumModifier()); auto& filter = remapper.get_entry_ref_filter(); v.logEnumStoreEvent("compactfixup", "start"); for (uint32_t doc = 0; doc < v.getNumDocs(); ++doc) { vespalib::ArrayRef indices(multi_value_mapping.get_writable(doc)); for (auto& entry : indices) { EnumIndex ref = multivalue::get_value_ref(entry).load_relaxed(); if (ref.valid() && filter.has(ref)) { ref = remapper.remap(ref); multivalue::get_value_ref(entry).store_release(ref); } } } } v.logEnumStoreEvent("compactfixup", "complete"); } template void remap_enum_store_refs(const EnumIndexRemapper&, AttributeVector&, attribute::MultiValueMapping &); template void remap_enum_store_refs(const EnumIndexRemapper&, AttributeVector&, attribute::MultiValueMapping &); }