diff options
Diffstat (limited to 'searchlib/src/vespa')
23 files changed, 64 insertions, 126 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/attrvector.h b/searchlib/src/vespa/searchlib/attribute/attrvector.h index 7713c210033..d1d2a1e8f3c 100644 --- a/searchlib/src/vespa/searchlib/attribute/attrvector.h +++ b/searchlib/src/vespa/searchlib/attribute/attrvector.h @@ -79,7 +79,6 @@ private: typedef typename B::WeightedFloat WeightedFloat; BaseType get(DocId doc) const override { return getHelper(doc, 0); } EnumHandle getEnum(DocId doc) const override { return getEnumHelper(doc, 0); } - uint32_t getAll(DocId doc, BaseType * v, uint32_t sz) const override { return getAllHelper<BaseType, BaseType>(doc, v, sz); } uint32_t get(DocId doc, EnumHandle * e, uint32_t sz) const override { return getAllEnumHelper(doc, e, sz); } uint32_t getValueCount(DocId doc) const override { return getValueCountHelper(doc); } @@ -125,7 +124,6 @@ private: } uint32_t get(DocId doc, WeightedEnum * v, uint32_t sz) const override { return getAllEnumHelper(doc, v, sz); } - uint32_t getAll(DocId doc, Weighted * v, uint32_t sz) const override { return getAllHelper<Weighted, BaseType>(doc, v, sz); } uint32_t get(DocId doc, WeightedInt * v, uint32_t sz) const override { return getAllHelper<WeightedInt, largeint_t>(doc, v, sz); } uint32_t get(DocId doc, WeightedFloat * v, uint32_t sz) const override { return getAllHelper<WeightedFloat, double>(doc, v, sz); } }; diff --git a/searchlib/src/vespa/searchlib/attribute/extendableattributes.cpp b/searchlib/src/vespa/searchlib/attribute/extendableattributes.cpp index 9c944a70b94..941450fccb5 100644 --- a/searchlib/src/vespa/searchlib/attribute/extendableattributes.cpp +++ b/searchlib/src/vespa/searchlib/attribute/extendableattributes.cpp @@ -54,15 +54,15 @@ MultiExtAttribute<T>::as_multi_value_attribute() const } template <typename T> -const attribute::IMultiValueReadView<T>* -MultiExtAttribute<T>::make_read_view(attribute::IMultiValueAttribute::Tag<T>, vespalib::Stash& stash) const +const attribute::IArrayReadView<T>* +MultiExtAttribute<T>::make_read_view(attribute::IMultiValueAttribute::ArrayTag<T>, vespalib::Stash& stash) const { return &stash.create<attribute::ExtendableNumericArrayMultiValueReadView<T, T>>(this->_data, this->_idx); } template <typename T> -const attribute::IMultiValueReadView<multivalue::WeightedValue<T>>* -MultiExtAttribute<T>::make_read_view(attribute::IMultiValueAttribute::Tag<multivalue::WeightedValue<T>>, vespalib::Stash& stash) const +const attribute::IWeightedSetReadView<T>* +MultiExtAttribute<T>::make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<T>, vespalib::Stash& stash) const { return &stash.create<attribute::ExtendableNumericArrayMultiValueReadView<multivalue::WeightedValue<T>, T>>(this->_data, this->_idx); } @@ -110,14 +110,14 @@ MultiStringExtAttribute::as_multi_value_attribute() const return this; } -const attribute::IMultiValueReadView<const char*>* -MultiStringExtAttribute::make_read_view(attribute::IMultiValueAttribute::Tag<const char*>, vespalib::Stash& stash) const +const attribute::IArrayReadView<const char*>* +MultiStringExtAttribute::make_read_view(attribute::IMultiValueAttribute::ArrayTag<const char*>, vespalib::Stash& stash) const { return &stash.create<attribute::ExtendableStringArrayMultiValueReadView<const char*>>(this->_buffer, this->_offsets, this->_idx); } -const attribute::IMultiValueReadView<multivalue::WeightedValue<const char*>>* -MultiStringExtAttribute::make_read_view(attribute::IMultiValueAttribute::Tag<multivalue::WeightedValue<const char*>>, vespalib::Stash& stash) const +const attribute::IWeightedSetReadView<const char*>* +MultiStringExtAttribute::make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<const char*>, vespalib::Stash& stash) const { return &stash.create<attribute::ExtendableStringArrayMultiValueReadView<multivalue::WeightedValue<const char*>>>(this->_buffer, this->_offsets, this->_idx); } @@ -150,8 +150,8 @@ WeightedSetIntegerExtAttribute::get(DocId doc, AttributeVector::WeightedInt * v, return valueCount; } -const attribute::IMultiValueReadView<multivalue::WeightedValue<int64_t>>* -WeightedSetIntegerExtAttribute::make_read_view(attribute::IMultiValueAttribute::Tag<multivalue::WeightedValue<int64_t>>, vespalib::Stash& stash) const +const attribute::IWeightedSetReadView<int64_t>* +WeightedSetIntegerExtAttribute::make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<int64_t>, vespalib::Stash& stash) const { return &stash.create<attribute::ExtendableNumericWeightedSetMultiValueReadView<multivalue::WeightedValue<int64_t>, int64_t>>(this->_data, this->_idx, this->get_weights()); } @@ -182,8 +182,8 @@ WeightedSetFloatExtAttribute::get(DocId doc, AttributeVector::WeightedFloat * v, return valueCount; } -const attribute::IMultiValueReadView<multivalue::WeightedValue<double>>* -WeightedSetFloatExtAttribute::make_read_view(attribute::IMultiValueAttribute::Tag<multivalue::WeightedValue<double>>, vespalib::Stash& stash) const +const attribute::IWeightedSetReadView<double>* +WeightedSetFloatExtAttribute::make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<double>, vespalib::Stash& stash) const { return &stash.create<attribute::ExtendableNumericWeightedSetMultiValueReadView<multivalue::WeightedValue<double>, double>>(this->_data, this->_idx, this->get_weights()); } @@ -216,8 +216,8 @@ WeightedSetStringExtAttribute::get(DocId doc, AttributeVector::WeightedConstChar return getAllHelper(doc, v, sz); } -const attribute::IMultiValueReadView<multivalue::WeightedValue<const char*>>* -WeightedSetStringExtAttribute::make_read_view(attribute::IMultiValueAttribute::Tag<multivalue::WeightedValue<const char*>>, vespalib::Stash& stash) const +const attribute::IWeightedSetReadView<const char*>* +WeightedSetStringExtAttribute::make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<const char*>, vespalib::Stash& stash) const { return &stash.create<attribute::ExtendableStringWeightedSetMultiValueReadView<multivalue::WeightedValue<const char*>>>(this->_buffer, this->_offsets, this->_idx, this->get_weights()); } diff --git a/searchlib/src/vespa/searchlib/attribute/extendableattributes.h b/searchlib/src/vespa/searchlib/attribute/extendableattributes.h index ebd1d1d764c..86e6be8eff7 100644 --- a/searchlib/src/vespa/searchlib/attribute/extendableattributes.h +++ b/searchlib/src/vespa/searchlib/attribute/extendableattributes.h @@ -151,8 +151,8 @@ public: const attribute::IMultiValueAttribute* as_multi_value_attribute() const override; // Implements attribute::IMultiValueAttribute - const attribute::IMultiValueReadView<T>* make_read_view(attribute::IMultiValueAttribute::Tag<T>, vespalib::Stash& stash) const override; - const attribute::IMultiValueReadView<multivalue::WeightedValue<T>>* make_read_view(attribute::IMultiValueAttribute::Tag<multivalue::WeightedValue<T>>, vespalib::Stash& stash) const override; + const attribute::IArrayReadView<T>* make_read_view(attribute::IMultiValueAttribute::ArrayTag<T>, vespalib::Stash& stash) const override; + const attribute::IWeightedSetReadView<T>* make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<T>, vespalib::Stash& stash) const override; }; template <typename T> @@ -185,8 +185,8 @@ public: void onAddDocs(DocId ) override { } const attribute::IMultiValueAttribute* as_multi_value_attribute() const override; // Implements attribute::IMultiValueAttribute - const attribute::IMultiValueReadView<const char*>* make_read_view(attribute::IMultiValueAttribute::Tag<const char*>, vespalib::Stash& stash) const override; - const attribute::IMultiValueReadView<multivalue::WeightedValue<const char*>>* make_read_view(attribute::IMultiValueAttribute::Tag<multivalue::WeightedValue<const char*>>, vespalib::Stash& stash) const override; + const attribute::IArrayReadView<const char*>* make_read_view(attribute::IMultiValueAttribute::ArrayTag<const char*>, vespalib::Stash& stash) const override; + const attribute::IWeightedSetReadView<const char*>* make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<const char*>, vespalib::Stash& stash) const override; }; @@ -229,7 +229,7 @@ public: bool add(int64_t v, int32_t w = 1) override; uint32_t get(DocId doc, AttributeVector::WeightedInt * v, uint32_t sz) const override; // Implements attribute::IMultiValueAttribute - const attribute::IMultiValueReadView<multivalue::WeightedValue<int64_t>>* make_read_view(attribute::IMultiValueAttribute::Tag<multivalue::WeightedValue<int64_t>>, vespalib::Stash& stash) const override; + const attribute::IWeightedSetReadView<int64_t>* make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<int64_t>, vespalib::Stash& stash) const override; }; class WeightedSetFloatExtAttribute @@ -248,7 +248,7 @@ public: bool add(double v, int32_t w = 1) override; uint32_t get(DocId doc, AttributeVector::WeightedFloat * v, uint32_t sz) const override; // Implements attribute::IMultiValueAttribute - const attribute::IMultiValueReadView<multivalue::WeightedValue<double>>* make_read_view(attribute::IMultiValueAttribute::Tag<multivalue::WeightedValue<double>>, vespalib::Stash& stash) const override; + const attribute::IWeightedSetReadView<double>* make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<double>, vespalib::Stash& stash) const override; }; class WeightedSetStringExtAttribute @@ -276,7 +276,7 @@ public: uint32_t get(DocId doc, AttributeVector::WeightedString * v, uint32_t sz) const override; uint32_t get(DocId doc, AttributeVector::WeightedConstChar * v, uint32_t sz) const override; // Implements attribute::IMultiValueAttribute - const attribute::IMultiValueReadView<multivalue::WeightedValue<const char*>>* make_read_view(attribute::IMultiValueAttribute::Tag<multivalue::WeightedValue<const char*>>, vespalib::Stash& stash) const override; + const attribute::IWeightedSetReadView<const char*>* make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<const char*>, vespalib::Stash& stash) const override; }; } // namespace search diff --git a/searchlib/src/vespa/searchlib/attribute/floatbase.h b/searchlib/src/vespa/searchlib/attribute/floatbase.h index f10e8189c29..8ca6eda6421 100644 --- a/searchlib/src/vespa/searchlib/attribute/floatbase.h +++ b/searchlib/src/vespa/searchlib/attribute/floatbase.h @@ -50,8 +50,6 @@ class FloatingPointAttributeTemplate : public FloatingPointAttribute { public: using Weighted = WeightedType<T>; - virtual uint32_t getAll(DocId doc, T * v, uint32_t sz) const = 0; - virtual uint32_t getAll(DocId doc, Weighted * v, uint32_t sz) const = 0; protected: using EnumEntryType = T; using LoadedNumericValueT = attribute::LoadedNumericValue<T>; diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp index c8a6309c282..a6a0dac9097 100644 --- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp +++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp @@ -160,7 +160,7 @@ bool ImportedAttributeVectorReadGuard::isImported() const template <typename MultiValueType> const IMultiValueReadView<MultiValueType>* -ImportedAttributeVectorReadGuard::make_read_view_helper(Tag<MultiValueType> tag, vespalib::Stash &stash) const +ImportedAttributeVectorReadGuard::make_read_view_helper(MultiValueTag<MultiValueType> tag, vespalib::Stash &stash) const { auto target_mv_attr = _target_attribute.as_multi_value_attribute(); if (target_mv_attr == nullptr) { diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h index 9e596078678..233ce5d06df 100644 --- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h +++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h @@ -89,7 +89,7 @@ public: bool isImported() const override; bool isUndefined(DocId doc) const override; template <typename MultiValueType> - const IMultiValueReadView<MultiValueType>* make_read_view_helper(Tag<MultiValueType> tag, vespalib::Stash& stash) const; + const IMultiValueReadView<MultiValueType>* make_read_view_helper(MultiValueTag<MultiValueType> tag, vespalib::Stash& stash) const; const IArrayReadView<int8_t>* make_read_view(ArrayTag<int8_t> tag, vespalib::Stash& stash) const override; const IArrayReadView<int16_t>* make_read_view(ArrayTag<int16_t> tag, vespalib::Stash& stash) const override; const IArrayReadView<int32_t>* make_read_view(ArrayTag<int32_t> tag, vespalib::Stash& stash) const override; diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.h b/searchlib/src/vespa/searchlib/attribute/integerbase.h index 926ced7c7e0..65d16ce934a 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.h +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.h @@ -49,8 +49,6 @@ class IntegerAttributeTemplate : public IntegerAttribute { public: using Weighted = WeightedType<T>; - virtual uint32_t getAll(DocId doc, T * v, uint32_t sz) const = 0; - virtual uint32_t getAll(DocId doc, Weighted * v, uint32_t sz) const = 0; protected: using EnumEntryType = T; using LoadedNumericValueT = attribute::LoadedNumericValue<T>; diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h index e07498d9ca4..cc128b0eef1 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h @@ -91,9 +91,6 @@ public: (void) doc; return std::numeric_limits<uint32_t>::max(); // does not have enum } - uint32_t getAll(DocId doc, T * v, uint32_t sz) const override { - return getHelper(doc, v, sz); - } uint32_t get(DocId doc, largeint_t * v, uint32_t sz) const override { return getHelper(doc, v, sz); } @@ -125,9 +122,6 @@ public: } return available; } - uint32_t getAll(DocId doc, Weighted * v, uint32_t sz) const override{ - return getWeightedHelper<Weighted, T>(doc, v, sz); - } uint32_t get(DocId doc, WeightedInt * v, uint32_t sz) const override { return getWeightedHelper<WeightedInt, largeint_t>(doc, v, sz); } diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h index 9f8506d3cb4..82bb98d5cf2 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h @@ -77,9 +77,6 @@ public: } return valueCount; } - uint32_t getAll(DocId doc, T * v, uint32_t sz) const override { - return getHelper(doc, v, sz); - } uint32_t get(DocId doc, largeint_t * v, uint32_t sz) const override { return getHelper(doc, v, sz); } @@ -96,9 +93,6 @@ public: } return valueCount; } - uint32_t getAll(DocId doc, Weighted * v, uint32_t sz) const override { - return getWeightedHelper<Weighted, T>(doc, v, sz); - } uint32_t get(DocId doc, WeightedInt * v, uint32_t sz) const override { return getWeightedHelper<WeightedInt, largeint_t>(doc, v, sz); } @@ -107,8 +101,8 @@ public: } // Implements attribute::IMultiValueAttribute - const attribute::IMultiValueReadView<T>* make_read_view(attribute::IMultiValueAttribute::Tag<T>, vespalib::Stash& stash) const override; - const attribute::IMultiValueReadView<multivalue::WeightedValue<T>>* make_read_view(attribute::IMultiValueAttribute::Tag<multivalue::WeightedValue<T>>, vespalib::Stash& stash) const override; + const attribute::IArrayReadView<T>* make_read_view(attribute::IMultiValueAttribute::ArrayTag<T>, vespalib::Stash& stash) const override; + const attribute::IWeightedSetReadView<T>* make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<T>, vespalib::Stash& stash) const override; private: using AttributeReader = PrimitiveReader<typename B::LoadedValueType>; diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.hpp index 81f8c1c910e..36c91a12498 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.hpp @@ -116,15 +116,15 @@ MultiValueNumericEnumAttribute<B, M>::onLoad(vespalib::Executor *) } template <typename B, typename M> -const attribute::IMultiValueReadView<typename B::BaseClass::BaseType>* -MultiValueNumericEnumAttribute<B, M>::make_read_view(attribute::IMultiValueAttribute::Tag<typename B::BaseClass::BaseType>, vespalib::Stash& stash) const +const attribute::IArrayReadView<typename B::BaseClass::BaseType>* +MultiValueNumericEnumAttribute<B, M>::make_read_view(attribute::IMultiValueAttribute::ArrayTag<typename B::BaseClass::BaseType>, vespalib::Stash& stash) const { return &stash.create<attribute::EnumeratedMultiValueReadView<T, M>>(this->_mvMapping.make_read_view(this->getCommittedDocIdLimit()), this->_enumStore); } template <typename B, typename M> -const attribute::IMultiValueReadView<multivalue::WeightedValue<typename B::BaseClass::BaseType>>* -MultiValueNumericEnumAttribute<B, M>::make_read_view(attribute::IMultiValueAttribute::Tag<multivalue::WeightedValue<typename B::BaseClass::BaseType>>, vespalib::Stash& stash) const +const attribute::IWeightedSetReadView<typename B::BaseClass::BaseType>* +MultiValueNumericEnumAttribute<B, M>::make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<typename B::BaseClass::BaseType>, vespalib::Stash& stash) const { return &stash.create<attribute::EnumeratedMultiValueReadView<multivalue::WeightedValue<T>, M>>(this->_mvMapping.make_read_view(this->getCommittedDocIdLimit()), this->_enumStore); } diff --git a/searchlib/src/vespa/searchlib/attribute/multistringattribute.h b/searchlib/src/vespa/searchlib/attribute/multistringattribute.h index 532af930220..4c3eeeed232 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multistringattribute.h @@ -107,8 +107,8 @@ public: getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override; // Implements attribute::IMultiValueAttribute - const attribute::IMultiValueReadView<const char*>* make_read_view(attribute::IMultiValueAttribute::Tag<const char*>, vespalib::Stash& stash) const override; - const attribute::IMultiValueReadView<multivalue::WeightedValue<const char*>>* make_read_view(attribute::IMultiValueAttribute::Tag<multivalue::WeightedValue<const char*>>, vespalib::Stash& stash) const override; + const attribute::IArrayReadView<const char*>* make_read_view(attribute::IMultiValueAttribute::ArrayTag<const char*>, vespalib::Stash& stash) const override; + const attribute::IWeightedSetReadView<const char*>* make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<const char*>, vespalib::Stash& stash) const override; }; diff --git a/searchlib/src/vespa/searchlib/attribute/multistringattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multistringattribute.hpp index 0edd459efc7..c3f8f99b4ab 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multistringattribute.hpp @@ -50,15 +50,15 @@ MultiValueStringAttributeT<B, M>::getSearch(QueryTermSimpleUP qTerm, } template <typename B, typename M> -const attribute::IMultiValueReadView<const char*>* -MultiValueStringAttributeT<B, M>::make_read_view(attribute::IMultiValueAttribute::Tag<const char*>, vespalib::Stash& stash) const +const attribute::IArrayReadView<const char*>* +MultiValueStringAttributeT<B, M>::make_read_view(attribute::IMultiValueAttribute::ArrayTag<const char*>, vespalib::Stash& stash) const { return &stash.create<attribute::EnumeratedMultiValueReadView<const char*, M>>(this->_mvMapping.make_read_view(this->getCommittedDocIdLimit()), this->_enumStore); } template <typename B, typename M> -const attribute::IMultiValueReadView<multivalue::WeightedValue<const char*>>* -MultiValueStringAttributeT<B, M>::make_read_view(attribute::IMultiValueAttribute::Tag<multivalue::WeightedValue<const char*>>, vespalib::Stash& stash) const +const attribute::IWeightedSetReadView<const char*>* +MultiValueStringAttributeT<B, M>::make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<const char*>, vespalib::Stash& stash) const { return &stash.create<attribute::EnumeratedMultiValueReadView<multivalue::WeightedValue<const char*>, M>>(this->_mvMapping.make_read_view(this->getCommittedDocIdLimit()), this->_enumStore); } diff --git a/searchlib/src/vespa/searchlib/attribute/multivalueattribute.h b/searchlib/src/vespa/searchlib/attribute/multivalueattribute.h index 5a2ee5c80d9..1d0e8d04ca8 100644 --- a/searchlib/src/vespa/searchlib/attribute/multivalueattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multivalueattribute.h @@ -82,8 +82,8 @@ public: const IMultiValueAttribute* as_multi_value_attribute() const override; // Implements attribute::IMultiValueAttribute - const attribute::IMultiValueReadView<ValueType>* make_read_view(attribute::IMultiValueAttribute::Tag<ValueType>, vespalib::Stash& stash) const override; - const attribute::IMultiValueReadView<multivalue::WeightedValue<ValueType>>* make_read_view(attribute::IMultiValueAttribute::Tag<multivalue::WeightedValue<ValueType>>, vespalib::Stash& stash) const override; + const attribute::IArrayReadView<ValueType>* make_read_view(attribute::IMultiValueAttribute::ArrayTag<ValueType>, vespalib::Stash& stash) const override; + const attribute::IWeightedSetReadView<ValueType>* make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<ValueType>, vespalib::Stash& stash) const override; }; } // namespace search diff --git a/searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp index 4e0e460da9c..622058550a2 100644 --- a/searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp @@ -300,8 +300,8 @@ MultiValueAttribute<B, M>::as_multi_value_attribute() const } template <typename B, typename M> -const attribute::IMultiValueReadView<multivalue::ValueType_t<M>>* -MultiValueAttribute<B, M>::make_read_view(attribute::IMultiValueAttribute::Tag<ValueType>, vespalib::Stash& stash) const +const attribute::IArrayReadView<multivalue::ValueType_t<M>>* +MultiValueAttribute<B, M>::make_read_view(attribute::IMultiValueAttribute::ArrayTag<ValueType>, vespalib::Stash& stash) const { if constexpr (std::is_same_v<MultiValueType, ValueType>) { return &stash.create<attribute::RawMultiValueReadView<MultiValueType>>(this->_mvMapping.make_read_view(this->getCommittedDocIdLimit())); @@ -311,8 +311,8 @@ MultiValueAttribute<B, M>::make_read_view(attribute::IMultiValueAttribute::Tag<V } template <typename B, typename M> -const attribute::IMultiValueReadView<multivalue::WeightedValue<multivalue::ValueType_t<M>>>* -MultiValueAttribute<B, M>::make_read_view(attribute::IMultiValueAttribute::Tag<multivalue::WeightedValue<ValueType>>, vespalib::Stash& stash) const +const attribute::IWeightedSetReadView<multivalue::ValueType_t<M>>* +MultiValueAttribute<B, M>::make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<ValueType>, vespalib::Stash& stash) const { if constexpr (std::is_same_v<MultiValueType, multivalue::WeightedValue<ValueType>>) { return &stash.create<attribute::RawMultiValueReadView<MultiValueType>>(this->_mvMapping.make_read_view(this->getCommittedDocIdLimit())); diff --git a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.h b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.h index f7efe27277e..77c8b7e318f 100644 --- a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.h @@ -45,12 +45,6 @@ public: uint32_t getEnum(DocId) const override { return std::numeric_limits<uint32_t>::max(); // does not have enum } - uint32_t getAll(DocId doc, int8_t * v, uint32_t sz) const override { - if (sz > 0) { - v[0] = getFast(doc); - } - return 1; - } uint32_t get(DocId doc, largeint_t * v, uint32_t sz) const override { if (sz > 0) { v[0] = static_cast<largeint_t>(getFast(doc)); @@ -69,7 +63,6 @@ public: } return 1; } - uint32_t getAll(DocId, Weighted *, uint32_t) const override { return 0; } uint32_t get(DocId doc, WeightedInt * v, uint32_t sz) const override { if (sz > 0) { v[0] = WeightedInt(static_cast<largeint_t>(getFast(doc))); diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h index 71a5f4f738e..cf3fa85a060 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h @@ -93,11 +93,6 @@ public: (void) doc; return std::numeric_limits<uint32_t>::max(); // does not have enum } - uint32_t getAll(DocId doc, T * v, uint32_t sz) const override { - (void) sz; - v[0] = getFast(doc); - return 1; - } uint32_t get(DocId doc, largeint_t * v, uint32_t sz) const override { (void) sz; v[0] = static_cast<largeint_t>(getFast(doc)); @@ -113,10 +108,6 @@ public: e[0] = getEnum(doc); return 1; } - uint32_t getAll(DocId doc, Weighted * v, uint32_t sz) const override { - (void) doc; (void) v; (void) sz; - return 0; - } uint32_t get(DocId doc, WeightedInt * v, uint32_t sz) const override { (void) sz; v[0] = WeightedInt(static_cast<largeint_t>(getFast(doc))); diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h index a269aec5c6b..5b0e1c6131e 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h @@ -74,12 +74,6 @@ public: double getFloat(DocId doc) const override { return static_cast<double>(get(doc)); } - uint32_t getAll(DocId doc, T * v, uint32_t sz) const override { - if (sz > 0) { - v[0] = get(doc); - } - return 1; - } uint32_t get(DocId doc, largeint_t * v, uint32_t sz) const override { if (sz > 0) { v[0] = getInt(doc); @@ -92,12 +86,6 @@ public: } return 1; } - uint32_t getAll(DocId doc, Weighted * v, uint32_t sz) const override { - if (sz > 0) { - v[0] = Weighted(get(doc)); - } - return 1; - } uint32_t get(DocId doc, WeightedInt * v, uint32_t sz) const override { if (sz > 0) { v[0] = WeightedInt(getInt(doc)); diff --git a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h index f6059d3d510..646edc786a3 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h @@ -100,12 +100,6 @@ public: uint32_t getEnum(DocId) const override { return std::numeric_limits<uint32_t>::max(); // does not have enum } - uint32_t getAll(DocId doc, T * v, uint32_t sz) const override { - if (sz > 0) { - v[0] = getFast(doc); - } - return 1; - } uint32_t get(DocId doc, largeint_t * v, uint32_t sz) const override { if (sz > 0) { v[0] = static_cast<largeint_t>(getFast(doc)); @@ -124,7 +118,6 @@ public: } return 1; } - uint32_t getAll(DocId, Weighted *, uint32_t) const override { return 0; } uint32_t get(DocId doc, WeightedInt * v, uint32_t sz) const override { if (sz > 0) { v[0] = WeightedInt(static_cast<largeint_t>(getFast(doc))); diff --git a/searchlib/src/vespa/searchlib/features/attributefeature.cpp b/searchlib/src/vespa/searchlib/features/attributefeature.cpp index 3b768633dd3..3e39ea830ca 100644 --- a/searchlib/src/vespa/searchlib/features/attributefeature.cpp +++ b/searchlib/src/vespa/searchlib/features/attributefeature.cpp @@ -344,7 +344,7 @@ struct MultiValueExecutorCreator { bool handle(vespalib::Stash &stash, const IAttributeVector *attribute) { auto multi_value_attribute = attribute->as_multi_value_attribute(); if (multi_value_attribute != nullptr) { - _array_read_view = multi_value_attribute->make_read_view(attribute::IMultiValueAttribute::Tag<typename T::BaseType>(), stash); + _array_read_view = multi_value_attribute->make_read_view(attribute::IMultiValueAttribute::ArrayTag<typename T::BaseType>(), stash); } return _array_read_view != nullptr; } diff --git a/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp b/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp index 98f276d1fed..ce7df5c9fb7 100644 --- a/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp @@ -390,7 +390,7 @@ make_multi_value_read_view(const IAttributeVector& attribute, vespalib::Stash& s { auto multi_value_attribute = attribute.as_multi_value_attribute(); if (multi_value_attribute != nullptr) { - return multi_value_attribute->make_read_view(attribute::IMultiValueAttribute::Tag<AT>(), stash); + return multi_value_attribute->make_read_view(attribute::IMultiValueAttribute::MultiValueTag<AT>(), stash); } return nullptr; } diff --git a/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp b/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp index 5e3dc727279..49d4149953a 100644 --- a/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp @@ -144,10 +144,9 @@ template<typename BaseType, typename V> FeatureExecutor & selectTypedExecutor(const IAttributeVector *attribute, V && vector, vespalib::Stash &stash) { if (!attribute->isImported()) { - using VT = BaseType; auto multi_value_attribute = attribute->as_multi_value_attribute(); if (multi_value_attribute != nullptr) { - auto array_read_view = multi_value_attribute->make_read_view(attribute::IMultiValueAttribute::Tag<VT>(), stash); + auto array_read_view = multi_value_attribute->make_read_view(attribute::IMultiValueAttribute::ArrayTag<BaseType>(), stash); if (array_read_view != nullptr) { return stash.create<RawExecutor<BaseType>>(array_read_view, std::forward<V>(vector)); } diff --git a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp index bdcbb3db633..73eaa773c53 100644 --- a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp @@ -89,6 +89,7 @@ NearestNeighborBlueprint::NearestNeighborBlueprint(const queryeval::FieldSpec& f _found_hits(), _algorithm(Algorithm::BRUTE_FORCE), _global_filter(GlobalFilter::create()), + _global_filter_set(false), _global_filter_hits(), _global_filter_hit_ratio() { @@ -122,51 +123,41 @@ void NearestNeighborBlueprint::set_global_filter(const GlobalFilter &global_filter) { _global_filter = global_filter.shared_from_this(); + _global_filter_set = true; auto nns_index = _attr_tensor.nearest_neighbor_index(); - LOG(debug, "set_global_filter with: %s / %s / %s", - (_approximate ? "approximate" : "exact"), - (nns_index ? "nns_index" : "no_index"), - (_global_filter->has_filter() ? "has_filter" : "no_filter")); if (_approximate && nns_index) { uint32_t est_hits = _attr_tensor.get_num_docs(); if (_global_filter->has_filter()) { uint32_t max_hits = _global_filter->filter()->countTrueBits(); - LOG(debug, "set_global_filter getNumDocs: %u / max_hits %u", est_hits, max_hits); double max_hit_ratio = static_cast<double>(max_hits) / est_hits; if (max_hit_ratio < _global_filter_lower_limit) { - _approximate = false; _algorithm = Algorithm::BRUTE_FORCE_FALLBACK; - LOG(debug, "too many hits filtered out, using brute force implementation"); } else { est_hits = std::min(est_hits, max_hits); } _global_filter_hits = max_hits; _global_filter_hit_ratio = max_hit_ratio; } - if (_approximate) { + if (_algorithm != Algorithm::BRUTE_FORCE_FALLBACK) { est_hits = std::min(est_hits, _target_num_hits); setEstimate(HitEstimate(est_hits, false)); - perform_top_k(); - LOG(debug, "perform_top_k found %zu hits", _found_hits.size()); + perform_top_k(nns_index); } } } void -NearestNeighborBlueprint::perform_top_k() +NearestNeighborBlueprint::perform_top_k(const search::tensor::NearestNeighborIndex* nns_index) { - auto nns_index = _attr_tensor.nearest_neighbor_index(); - if (_approximate && nns_index) { - auto lhs = _query_tensor->cells(); - uint32_t k = _target_num_hits; - if (_global_filter->has_filter()) { - auto filter = _global_filter->filter(); - _found_hits = nns_index->find_top_k_with_filter(k, lhs, *filter, k + _explore_additional_hits, _distance_threshold); - _algorithm = Algorithm::INDEX_TOP_K_WITH_FILTER; - } else { - _found_hits = nns_index->find_top_k(k, lhs, k + _explore_additional_hits, _distance_threshold); - _algorithm = Algorithm::INDEX_TOP_K; - } + auto lhs = _query_tensor->cells(); + uint32_t k = _target_num_hits; + if (_global_filter->has_filter()) { + auto filter = _global_filter->filter(); + _found_hits = nns_index->find_top_k_with_filter(k, lhs, *filter, k + _explore_additional_hits, _distance_threshold); + _algorithm = Algorithm::INDEX_TOP_K_WITH_FILTER; + } else { + _found_hits = nns_index->find_top_k(k, lhs, k + _explore_additional_hits, _distance_threshold); + _algorithm = Algorithm::INDEX_TOP_K; } } @@ -191,14 +182,15 @@ NearestNeighborBlueprint::visitMembers(vespalib::ObjectVisitor& visitor) const visitor.visitString("query_tensor", _query_tensor->type().to_spec()); visitor.visitInt("target_num_hits", _target_num_hits); visitor.visitInt("explore_additional_hits", _explore_additional_hits); - visitor.visitBool("approximate", _approximate); + visitor.visitBool("wanted_approximate", _approximate); visitor.visitBool("has_index", _attr_tensor.nearest_neighbor_index()); visitor.visitString("algorithm", to_string(_algorithm)); visitor.visitInt("top_k_hits", _found_hits.size()); visitor.openStruct("global_filter", "GlobalFilter"); - visitor.visitBool("is_set", (_global_filter != nullptr)); - visitor.visitBool("has_filter", (_global_filter && _global_filter->has_filter())); + visitor.visitBool("wanted", getState().want_global_filter()); + visitor.visitBool("set", _global_filter_set); + visitor.visitBool("calculated", _global_filter->has_filter()); visitor.visitFloat("lower_limit", _global_filter_lower_limit); visitor.visitFloat("upper_limit", _global_filter_upper_limit); if (_global_filter_hits.has_value()) { diff --git a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.h index 7922036dc42..7637c4dd6b7 100644 --- a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.h @@ -41,10 +41,11 @@ private: std::vector<search::tensor::NearestNeighborIndex::Neighbor> _found_hits; Algorithm _algorithm; std::shared_ptr<const GlobalFilter> _global_filter; + bool _global_filter_set; std::optional<uint32_t> _global_filter_hits; std::optional<double> _global_filter_hit_ratio; - void perform_top_k(); + void perform_top_k(const search::tensor::NearestNeighborIndex* nns_index); public: NearestNeighborBlueprint(const queryeval::FieldSpec& field, const tensor::ITensorAttribute& attr_tensor, @@ -60,7 +61,6 @@ public: const vespalib::eval::Value& get_query_tensor() const { return *_query_tensor; } uint32_t get_target_num_hits() const { return _target_num_hits; } void set_global_filter(const GlobalFilter &global_filter) override; - bool may_approximate() const { return _approximate; } Algorithm get_algorithm() const { return _algorithm; } double get_distance_threshold() const { return _distance_threshold; } |