diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-05-27 18:51:20 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-05-27 18:51:20 +0000 |
commit | 4802b8fdcf1f7621d48acdae343a25e83ebe1b85 (patch) | |
tree | 2fed6d2d81e038f13f730557558e35d6a637fc65 /searchlib | |
parent | 23e9dd2577e9d5bd32e410e2759a82aad6e185ee (diff) |
Avoid using vespalib::Identifiable.
Diffstat (limited to 'searchlib')
36 files changed, 72 insertions, 132 deletions
diff --git a/searchlib/src/apps/tests/memoryindexstress_test.cpp b/searchlib/src/apps/tests/memoryindexstress_test.cpp index 07747a66892..d8f8cd9d67c 100644 --- a/searchlib/src/apps/tests/memoryindexstress_test.cpp +++ b/searchlib/src/apps/tests/memoryindexstress_test.cpp @@ -1,18 +1,10 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/document/annotation/spanlist.h> -#include <vespa/document/annotation/spantree.h> -#include <vespa/document/datatype/documenttype.h> -#include <vespa/document/fieldvalue/document.h> -#include <vespa/document/fieldvalue/stringfieldvalue.h> -#include <vespa/document/repo/configbuilder.h> -#include <vespa/document/repo/documenttyperepo.h> -#include <vespa/document/repo/fixedtyperepo.h> + #include <vespa/searchlib/common/scheduletaskcallback.h> #include <vespa/searchlib/fef/matchdata.h> #include <vespa/searchlib/fef/matchdatalayout.h> #include <vespa/searchlib/fef/termfieldmatchdata.h> -#include <vespa/searchlib/index/i_field_length_inspector.h> #include <vespa/searchlib/memoryindex/memory_index.h> #include <vespa/searchlib/query/tree/simplequery.h> #include <vespa/searchlib/queryeval/fake_requestcontext.h> @@ -20,11 +12,20 @@ #include <vespa/searchlib/queryeval/fake_searchable.h> #include <vespa/searchlib/queryeval/searchiterator.h> #include <vespa/searchlib/test/index/mock_field_length_inspector.h> +#include <vespa/document/annotation/spanlist.h> +#include <vespa/document/annotation/spantree.h> +#include <vespa/document/datatype/documenttype.h> +#include <vespa/document/fieldvalue/document.h> +#include <vespa/document/fieldvalue/stringfieldvalue.h> +#include <vespa/document/repo/configbuilder.h> +#include <vespa/document/repo/documenttyperepo.h> +#include <vespa/document/repo/fixedtyperepo.h> #include <vespa/vespalib/util/rand48.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/threadstackexecutor.h> #include <vespa/vespalib/util/sequencedtaskexecutor.h> #include <vespa/vespalib/util/size_literals.h> +#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/log/log.h> LOG_SETUP("memoryindexstress_test"); diff --git a/searchlib/src/apps/vespa-attribute-inspect/vespa-attribute-inspect.cpp b/searchlib/src/apps/vespa-attribute-inspect/vespa-attribute-inspect.cpp index 84a4f43cc8e..d9d6bb56152 100644 --- a/searchlib/src/apps/vespa-attribute-inspect/vespa-attribute-inspect.cpp +++ b/searchlib/src/apps/vespa-attribute-inspect/vespa-attribute-inspect.cpp @@ -40,7 +40,7 @@ void LoadAttribute::applyUpdate(const AttributePtr & ptr) { std::cout << "applyUpdate" << std::endl; - if (ptr->getClass().inherits(IntegerAttribute::classId)) { + if (ptr->isIntegerType()) { IntegerAttribute * a = static_cast<IntegerAttribute *>(ptr.get()); if (ptr->hasMultiValue()) { a->append(0, 123456789, 1); @@ -48,7 +48,7 @@ LoadAttribute::applyUpdate(const AttributePtr & ptr) a->update(0, 123456789); } a->commit(); - } else if (ptr->getClass().inherits(FloatingPointAttribute::classId)) { + } else if (ptr->isFloatingPointType()) { FloatingPointAttribute * a = static_cast<FloatingPointAttribute *>(ptr.get()); if (ptr->hasMultiValue()) { a->append(0, 123456789.5f, 1); @@ -56,7 +56,7 @@ LoadAttribute::applyUpdate(const AttributePtr & ptr) a->update(0, 123456789); } a->commit(); - } else if (ptr->getClass().inherits(StringAttribute::classId)) { + } else if (ptr->isStringType()) { StringAttribute * a = static_cast<StringAttribute *>(ptr.get()); if (ptr->hasMultiValue()) { a->append(0, "non-existing string value", 1); diff --git a/searchlib/src/tests/attribute/attribute_test.cpp b/searchlib/src/tests/attribute/attribute_test.cpp index 64edb30520b..fbfe203ee9e 100644 --- a/searchlib/src/tests/attribute/attribute_test.cpp +++ b/searchlib/src/tests/attribute/attribute_test.cpp @@ -1,10 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/document/fieldvalue/intfieldvalue.h> -#include <vespa/document/fieldvalue/stringfieldvalue.h> -#include <vespa/document/update/arithmeticvalueupdate.h> -#include <vespa/document/update/assignvalueupdate.h> -#include <vespa/document/update/mapvalueupdate.h> + #include <vespa/searchlib/attribute/address_space_components.h> #include <vespa/searchlib/attribute/attribute.h> #include <vespa/searchlib/attribute/attributefactory.h> @@ -20,11 +16,17 @@ #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/searchlib/test/weighted_type_test_utils.h> #include <vespa/searchlib/util/randomgenerator.h> +#include <vespa/document/fieldvalue/intfieldvalue.h> +#include <vespa/document/fieldvalue/stringfieldvalue.h> +#include <vespa/document/update/arithmeticvalueupdate.h> +#include <vespa/document/update/assignvalueupdate.h> +#include <vespa/document/update/mapvalueupdate.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/gtest/gtest.h> #include <vespa/vespalib/util/mmap_file_allocator_factory.h> #include <vespa/vespalib/util/round_up_to_page_size.h> #include <vespa/vespalib/util/size_literals.h> +#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/fastos/file.h> #include <cmath> #include <iostream> @@ -1412,7 +1414,7 @@ AttributeTest::testArithmeticValueUpdate(const AttributePtr & ptr) ASSERT_TRUE(vec.update(0, 100)); EXPECT_TRUE(vec.apply(0, Arith(Arith::Div, 0))); ptr->commit(); - if (ptr->getClass().inherits(FloatingPointAttribute::classId)) { + if (ptr->isFloatingPointType()) { EXPECT_EQ(ptr->getStatus().getUpdateCount(), 86u); EXPECT_EQ(ptr->getStatus().getNonIdempotentUpdateCount(), 66u); } else { // does not apply for interger attributes @@ -1427,7 +1429,7 @@ AttributeTest::testArithmeticValueUpdate(const AttributePtr & ptr) // try divide by zero with empty change vector EXPECT_TRUE(vec.apply(0, Arith(Arith::Div, 0))); ptr->commit(); - if (ptr->getClass().inherits(FloatingPointAttribute::classId)) { + if (ptr->isFloatingPointType()) { EXPECT_EQ(ptr->getStatus().getUpdateCount(), 87u); EXPECT_EQ(ptr->getStatus().getNonIdempotentUpdateCount(), 67u); } else { // does not apply for interger attributes @@ -1486,7 +1488,7 @@ AttributeTest::testArithmeticWithUndefinedValue(const AttributePtr & ptr, BaseTy std::vector<BufferType> buf(1); ptr->get(0, &buf[0], 1); - if (ptr->getClass().inherits(FloatingPointAttribute::classId)) { + if (ptr->isFloatingPointType()) { EXPECT_TRUE(std::isnan(buf[0])); } else { EXPECT_EQ(buf[0], after); diff --git a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp index d4dc8c15f23..d1dde5ef6ea 100644 --- a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp +++ b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp @@ -4,20 +4,19 @@ #include <vespa/searchlib/attribute/attribute.h> #include <vespa/searchlib/attribute/attributefactory.h> -#include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/searchlib/util/randomgenerator.h> #include <vespa/vespalib/util/compress.h> #include <vespa/searchlib/fef/termfieldmatchdata.h> - #include <vespa/searchlib/attribute/i_document_weight_attribute.h> #include <vespa/searchlib/queryeval/document_weight_search_iterator.h> #include <vespa/searchlib/test/searchiteratorverifier.h> #include <vespa/searchlib/common/bitvectoriterator.h> +#include <vespa/searchlib/queryeval/executeinfo.h> #include <vespa/searchlib/parsequery/parse.h> #include <vespa/searchcommon/attribute/config.h> +#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/log/log.h> -#include <vespa/searchlib/queryeval/executeinfo.h> LOG_SETUP("bitvector_test"); diff --git a/searchlib/src/tests/attribute/enum_attribute_compaction/enum_attribute_compaction_test.cpp b/searchlib/src/tests/attribute/enum_attribute_compaction/enum_attribute_compaction_test.cpp index 7652e7e30a4..f54e1efdf5c 100644 --- a/searchlib/src/tests/attribute/enum_attribute_compaction/enum_attribute_compaction_test.cpp +++ b/searchlib/src/tests/attribute/enum_attribute_compaction/enum_attribute_compaction_test.cpp @@ -1,12 +1,13 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vespalib/gtest/gtest.h> -#include <vespa/searchcommon/attribute/attributecontent.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/integerbase.h> #include <vespa/searchlib/attribute/stringbase.h> -#include <vespa/searchcommon/attribute/config.h> #include <vespa/searchlib/test/weighted_type_test_utils.h> +#include <vespa/searchcommon/attribute/attributecontent.h> +#include <vespa/searchcommon/attribute/config.h> +#include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/vespalib/gtest/gtest.h> #include <vespa/log/log.h> LOG_SETUP("enum_attribute_compaction_test"); diff --git a/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp b/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp index 44ae4f7385e..92c3da40fe9 100644 --- a/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp +++ b/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp @@ -1,7 +1,5 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/document/fieldvalue/intfieldvalue.h> -#include <vespa/document/fieldvalue/stringfieldvalue.h> #include <vespa/searchlib/attribute/attribute.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/attributefilesavetarget.h> @@ -18,13 +16,13 @@ #include <vespa/searchlib/util/file_settings.h> #include <vespa/searchlib/util/randomgenerator.h> #include <vespa/searchcommon/attribute/config.h> +#include <vespa/document/fieldvalue/intfieldvalue.h> +#include <vespa/document/fieldvalue/stringfieldvalue.h> #include <vespa/vespalib/data/databuffer.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/compress.h> -#include <vespa/vespalib/util/size_literals.h> - +#include <vespa/vespalib/stllike/asciistream.h> #include <limits> -#include <iostream> #include <cmath> using search::AttributeFactory; diff --git a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp index 48f56394800..6df60f2ac4c 100644 --- a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp @@ -279,7 +279,7 @@ void add_docs(AttributeVector *attr, size_t n) { AttributeVector::DocId docid; for (size_t i = 0; i < n; ++i) { attr->addDoc(docid); - if (attr->inherits(PredicateAttribute::classId)) { + if (attr->isPredicateType()) { const_cast<uint8_t *>(static_cast<PredicateAttribute *>(attr)->getMinFeatureVector().first)[docid] = 0; } } diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp index 78d82459260..6390e30adff 100644 --- a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp +++ b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp @@ -20,6 +20,7 @@ #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/compress.h> #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/vespalib/stllike/asciistream.h> #include <set> #include <vespa/log/log.h> diff --git a/searchlib/src/vespa/searchcommon/attribute/iattributevector.h b/searchlib/src/vespa/searchcommon/attribute/iattributevector.h index fa91f301b92..bac5181871a 100644 --- a/searchlib/src/vespa/searchcommon/attribute/iattributevector.h +++ b/searchlib/src/vespa/searchcommon/attribute/iattributevector.h @@ -363,6 +363,11 @@ public: return getBasicType() == BasicType::STRING; } + + virtual bool isPredicateType() const { return getBasicType() == BasicType::PREDICATE; } + virtual bool isTensorType() const { return getBasicType() == BasicType::TENSOR; } + virtual bool isReferenceType() const { return getBasicType() == BasicType::REFERENCE; } + /** * Returns whether this is a multi value attribute. **/ diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_operation.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_operation.cpp index e21e272f225..57980237f21 100644 --- a/searchlib/src/vespa/searchlib/attribute/attribute_operation.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attribute_operation.cpp @@ -1,10 +1,11 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "attribute_operation.h" -#include <vespa/searchlib/attribute/singlenumericattribute.h> +#include "singlenumericattribute.h" #include <vespa/searchlib/common/bitvector.h> #include <vespa/searchcommon/attribute/basictype.h> #include <vespa/vespalib/util/exceptions.h> +#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/util/array.hpp> #include <vespa/log/log.h> diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp index 2ad95a584ab..5db3411ba73 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp @@ -51,8 +51,6 @@ const vespalib::string docIdLimitTag = "docIdLimit"; namespace search { -IMPLEMENT_IDENTIFIABLE_ABSTRACT(AttributeVector, vespalib::Identifiable); - AttributeVector::BaseName::BaseName(vespalib::stringref base, vespalib::stringref name) : string(base), _name(name) @@ -500,16 +498,14 @@ AttributeVector::addReservedDoc() assert(docId < getNumDocs()); clearDoc(docId); commit(); - const vespalib::Identifiable::RuntimeClass &info = getClass(); - if (info.inherits(search::FloatingPointAttribute::classId)) { - FloatingPointAttribute &vec = - static_cast<FloatingPointAttribute &>(*this); + FloatingPointAttribute * vec = dynamic_cast<FloatingPointAttribute *>(this); + if (vec) { if (hasMultiValue()) { - bool appendedUndefined = vec.append(0, attribute::getUndefined<double>(), 1); + bool appendedUndefined = vec->append(0, attribute::getUndefined<double>(), 1); assert(appendedUndefined); (void) appendedUndefined; } else { - bool updatedUndefined = vec.update(0, attribute::getUndefined<double>()); + bool updatedUndefined = vec->update(0, attribute::getUndefined<double>()); assert(updatedUndefined); (void) updatedUndefined; } diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h index a35fb13b9ff..2d0a03a0d90 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.h +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h @@ -12,11 +12,8 @@ #include <vespa/searchcommon/common/range.h> #include <vespa/searchcommon/common/undefinedvalues.h> #include <vespa/searchlib/common/i_compactable_lid_space.h> -#include <vespa/searchlib/common/identifiable.h> #include <vespa/searchlib/common/commit_param.h> #include <vespa/searchlib/queryeval/searchiterator.h> -#include <vespa/vespalib/objects/identifiable.h> -#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/util/generationholder.h> #include <vespa/vespalib/util/time.h> #include <cmath> @@ -35,6 +32,11 @@ namespace vespalib { class Executor; } +namespace vespalib::alloc { + class MemoryAllocator; + class Alloc; +} + namespace search { template <typename T> class ComponentGuard; @@ -74,28 +76,6 @@ using document::ArithmeticValueUpdate; using document::MapValueUpdate; using document::FieldValue; -template <typename T> -class UnWeightedType -{ -public: - UnWeightedType() : _value(T()) { } - UnWeightedType(T v) : _value(v) { } - const T & getValue() const { return _value; } - void setValue(const T & v) { _value = v; } - int32_t getWeight() const { return 1; } - void setWeight(int32_t w) { (void) w; } - - bool operator==(const UnWeightedType<T> & rhs) const { - return _value == rhs._value; - } - -private: - T _value; -}; - -template <typename T> -vespalib::asciistream & operator << (vespalib::asciistream & os, const UnWeightedType<T> & v); - class IExtendAttribute { public: @@ -103,11 +83,10 @@ public: virtual bool add(double, int32_t = 1) { return false; } virtual bool add(const char *, int32_t = 1) { return false; } - virtual ~IExtendAttribute() {} + virtual ~IExtendAttribute() = default; }; -class AttributeVector : public vespalib::Identifiable, - public attribute::IAttributeVector, +class AttributeVector : public attribute::IAttributeVector, public common::ICompactableLidSpace, public attribute::ReadableAttributeVector { @@ -347,7 +326,6 @@ protected: const std::shared_ptr<vespalib::alloc::MemoryAllocator>& get_memory_allocator() const noexcept { return _memory_allocator; } vespalib::alloc::Alloc get_initial_alloc(); public: - DECLARE_IDENTIFIABLE_ABSTRACT(AttributeVector); bool isLoaded() const { return _loaded; } void logEnumStoreEvent(const char *reason, const char *stage); diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.hpp b/searchlib/src/vespa/searchlib/attribute/attributevector.hpp index c75f7788467..959d72bd5ec 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.hpp +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.hpp @@ -87,7 +87,7 @@ AttributeVector::applyArithmetic(ChangeVectorT< ChangeTemplate<T> > & changes, D } else if (op == ArithmeticValueUpdate::Mul) { changes.push_back(ChangeTemplate<T>(ChangeBase::MUL, doc, 0, 0)); } else if (op == ArithmeticValueUpdate::Div) { - if (this->getClass().inherits(IntegerAttribute::classId) && aop == 0) { + if ((aop == 0) && isIntegerType()) { divideByZeroWarning(); } else { changes.push_back(ChangeTemplate<T>(ChangeBase::DIV, doc, 0, 0)); @@ -173,10 +173,5 @@ bool AttributeVector::remove(ChangeVectorT< ChangeTemplate<T> > & changes, DocId return retval; } -template<typename T> -vespalib::asciistream & operator << (vespalib::asciistream & os, const UnWeightedType<T> & v) { - return os << "(" << v._value << ", 1)"; -} - } diff --git a/searchlib/src/vespa/searchlib/attribute/extendable_string_array_multi_value_read_view.cpp b/searchlib/src/vespa/searchlib/attribute/extendable_string_array_multi_value_read_view.cpp index fef05a8ce08..ad3b9c403a0 100644 --- a/searchlib/src/vespa/searchlib/attribute/extendable_string_array_multi_value_read_view.cpp +++ b/searchlib/src/vespa/searchlib/attribute/extendable_string_array_multi_value_read_view.cpp @@ -5,7 +5,7 @@ namespace search::attribute { template <class MultiValueType> -ExtendableStringArrayMultiValueReadView<MultiValueType>::ExtendableStringArrayMultiValueReadView(const std::vector<char>& buffer, const vespalib::Array<uint32_t>& offsets, const std::vector<uint32_t>& idx) +ExtendableStringArrayMultiValueReadView<MultiValueType>::ExtendableStringArrayMultiValueReadView(const std::vector<char>& buffer, const Offsets & offsets, const std::vector<uint32_t>& idx) : attribute::IMultiValueReadView<MultiValueType>(), _buffer(buffer), _offsets(offsets), diff --git a/searchlib/src/vespa/searchlib/attribute/extendable_string_array_multi_value_read_view.h b/searchlib/src/vespa/searchlib/attribute/extendable_string_array_multi_value_read_view.h index 1104d749886..d83398b5568 100644 --- a/searchlib/src/vespa/searchlib/attribute/extendable_string_array_multi_value_read_view.h +++ b/searchlib/src/vespa/searchlib/attribute/extendable_string_array_multi_value_read_view.h @@ -3,7 +3,7 @@ #pragma once #include <vespa/searchcommon/attribute/i_multi_value_read_view.h> -#include <vespa/vespalib/util/array.h> +#include <vespa/vespalib/stllike/allocator.h> namespace search::attribute { @@ -16,12 +16,13 @@ namespace search::attribute { template <typename MultiValueType> class ExtendableStringArrayMultiValueReadView : public attribute::IMultiValueReadView<MultiValueType> { + using Offsets = std::vector<uint32_t, vespalib::allocator_large<uint32_t>>; const std::vector<char>& _buffer; - const vespalib::Array<uint32_t>& _offsets; + const Offsets & _offsets; const std::vector<uint32_t>& _idx; mutable std::vector<MultiValueType> _copy; public: - ExtendableStringArrayMultiValueReadView(const std::vector<char>& buffer, const vespalib::Array<uint32_t>& offsets, const std::vector<uint32_t>& idx); + ExtendableStringArrayMultiValueReadView(const std::vector<char>& buffer, const Offsets & offsets, const std::vector<uint32_t>& idx); ~ExtendableStringArrayMultiValueReadView() override; vespalib::ConstArrayRef<MultiValueType> get_values(uint32_t doc_id) const override; }; diff --git a/searchlib/src/vespa/searchlib/attribute/extendable_string_weighted_set_multi_value_read_view.cpp b/searchlib/src/vespa/searchlib/attribute/extendable_string_weighted_set_multi_value_read_view.cpp index eda50dd7172..f69938f061d 100644 --- a/searchlib/src/vespa/searchlib/attribute/extendable_string_weighted_set_multi_value_read_view.cpp +++ b/searchlib/src/vespa/searchlib/attribute/extendable_string_weighted_set_multi_value_read_view.cpp @@ -5,7 +5,7 @@ namespace search::attribute { template <class MultiValueType> -ExtendableStringWeightedSetMultiValueReadView<MultiValueType>::ExtendableStringWeightedSetMultiValueReadView(const std::vector<char>& buffer, const vespalib::Array<uint32_t>& offsets, const std::vector<uint32_t>& idx, const std::vector<int32_t>& weights) +ExtendableStringWeightedSetMultiValueReadView<MultiValueType>::ExtendableStringWeightedSetMultiValueReadView(const std::vector<char>& buffer, const Offsets & offsets, const std::vector<uint32_t>& idx, const std::vector<int32_t>& weights) : attribute::IMultiValueReadView<MultiValueType>(), _buffer(buffer), _offsets(offsets), diff --git a/searchlib/src/vespa/searchlib/attribute/extendable_string_weighted_set_multi_value_read_view.h b/searchlib/src/vespa/searchlib/attribute/extendable_string_weighted_set_multi_value_read_view.h index 2c55452faaf..011669ffd47 100644 --- a/searchlib/src/vespa/searchlib/attribute/extendable_string_weighted_set_multi_value_read_view.h +++ b/searchlib/src/vespa/searchlib/attribute/extendable_string_weighted_set_multi_value_read_view.h @@ -3,7 +3,7 @@ #pragma once #include <vespa/searchcommon/attribute/i_multi_value_read_view.h> -#include <vespa/vespalib/util/array.h> +#include <vespa/vespalib/stllike/allocator.h> namespace search::attribute { @@ -16,13 +16,14 @@ namespace search::attribute { template <typename MultiValueType> class ExtendableStringWeightedSetMultiValueReadView : public attribute::IMultiValueReadView<MultiValueType> { + using Offsets = std::vector<uint32_t, vespalib::allocator_large<uint32_t>>; const std::vector<char>& _buffer; - const vespalib::Array<uint32_t>& _offsets; + const Offsets & _offsets; const std::vector<uint32_t>& _idx; const std::vector<int32_t>& _weights; mutable std::vector<MultiValueType> _copy; public: - ExtendableStringWeightedSetMultiValueReadView(const std::vector<char>& buffer, const vespalib::Array<uint32_t>& offsets, const std::vector<uint32_t>& idx, const std::vector<int32_t>& weights); + ExtendableStringWeightedSetMultiValueReadView(const std::vector<char>& buffer, const Offsets & offsets, const std::vector<uint32_t>& idx, const std::vector<int32_t>& weights); ~ExtendableStringWeightedSetMultiValueReadView() override; vespalib::ConstArrayRef<MultiValueType> get_values(uint32_t doc_id) const override; }; diff --git a/searchlib/src/vespa/searchlib/attribute/floatbase.cpp b/searchlib/src/vespa/searchlib/attribute/floatbase.cpp index 3ba79ded478..b9d7fb7c81b 100644 --- a/searchlib/src/vespa/searchlib/attribute/floatbase.cpp +++ b/searchlib/src/vespa/searchlib/attribute/floatbase.cpp @@ -6,8 +6,6 @@ namespace search { -IMPLEMENT_IDENTIFIABLE_ABSTRACT(FloatingPointAttribute, NumericAttribute); - FloatingPointAttribute::FloatingPointAttribute(const vespalib::string & name, const Config & c) : NumericAttribute(name, c), _changes() diff --git a/searchlib/src/vespa/searchlib/attribute/floatbase.h b/searchlib/src/vespa/searchlib/attribute/floatbase.h index 787273c2050..40b0b9c72e2 100644 --- a/searchlib/src/vespa/searchlib/attribute/floatbase.h +++ b/searchlib/src/vespa/searchlib/attribute/floatbase.h @@ -11,7 +11,6 @@ namespace search { class FloatingPointAttribute : public NumericAttribute { public: - DECLARE_IDENTIFIABLE_ABSTRACT(FloatingPointAttribute); ~FloatingPointAttribute() override; template<typename Accessor> bool append(DocId doc, Accessor & ac) { diff --git a/searchlib/src/vespa/searchlib/attribute/floatbase.hpp b/searchlib/src/vespa/searchlib/attribute/floatbase.hpp index 2eaf501cce8..b406f5e85b1 100644 --- a/searchlib/src/vespa/searchlib/attribute/floatbase.hpp +++ b/searchlib/src/vespa/searchlib/attribute/floatbase.hpp @@ -3,6 +3,7 @@ #include "floatbase.h" #include <vespa/vespalib/util/exceptions.h> +#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/searchcommon/attribute/config.h> namespace search { diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.cpp b/searchlib/src/vespa/searchlib/attribute/integerbase.cpp index cd38b119e7c..b9d33f0aa9e 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.cpp +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.cpp @@ -7,8 +7,6 @@ namespace search { -IMPLEMENT_IDENTIFIABLE_ABSTRACT(IntegerAttribute, NumericAttribute); - IntegerAttribute::IntegerAttribute(const vespalib::string & name, const Config & c) : NumericAttribute(name, c), _changes() diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.h b/searchlib/src/vespa/searchlib/attribute/integerbase.h index 42f169a0c1a..170d6fcf941 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.h +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.h @@ -12,7 +12,6 @@ class IntegerAttribute : public NumericAttribute { public: ~IntegerAttribute(); - DECLARE_IDENTIFIABLE_ABSTRACT(IntegerAttribute); bool update(DocId doc, largeint_t v) { return AttributeVector::update(_changes, doc, NumericChangeData<largeint_t>(v)); } diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.hpp b/searchlib/src/vespa/searchlib/attribute/integerbase.hpp index e25b92d1308..93e9a68b074 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.hpp +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.hpp @@ -3,6 +3,7 @@ #include "integerbase.h" #include <vespa/vespalib/util/exceptions.h> +#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/searchcommon/attribute/config.h> namespace search { diff --git a/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp index 0d479855c4f..d8b01afe094 100644 --- a/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp @@ -4,8 +4,11 @@ #include "search_context.h" #include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/util/exceptions.h> +#include <vespa/vespalib/util/classname.h> using vespalib::make_string_short::fmt; +using vespalib::getClassName; + namespace search { using largeint_t = attribute::IAttributeVector::largeint_t; @@ -22,139 +25,117 @@ NotImplementedAttribute::NotImplementedAttribute(const vespalib::string &name, c void NotImplementedAttribute::notImplemented() const { throw vespalib::UnsupportedOperationException(fmt("The function is not implemented for attribute '%s' of type '%s'.", - getName().c_str(), getNativeClassName().c_str())); + getName().c_str(), getClassName(*this).c_str())); } uint32_t NotImplementedAttribute::getValueCount(DocId) const { notImplemented(); - return 0; } largeint_t NotImplementedAttribute::getInt(DocId) const { notImplemented(); - return 0; } double NotImplementedAttribute::getFloat(DocId) const { notImplemented(); - return 0; } const char * NotImplementedAttribute::getString(DocId, char *, size_t) const { notImplemented(); - return NULL; } uint32_t NotImplementedAttribute::get(DocId, largeint_t *, uint32_t) const { notImplemented(); - return 0; } uint32_t NotImplementedAttribute::get(DocId, double *, uint32_t) const { notImplemented(); - return 0; } uint32_t NotImplementedAttribute::get(DocId, vespalib::string *, uint32_t) const { notImplemented(); - return 0; } uint32_t NotImplementedAttribute::get(DocId, const char **, uint32_t) const { notImplemented(); - return 0; } uint32_t NotImplementedAttribute::get(DocId, EnumHandle *, uint32_t) const { notImplemented(); - return 0; } uint32_t NotImplementedAttribute::get(DocId, WeightedInt *, uint32_t) const { notImplemented(); - return 0; } uint32_t NotImplementedAttribute::get(DocId, WeightedFloat *, uint32_t) const { notImplemented(); - return 0; } uint32_t NotImplementedAttribute::get(DocId, WeightedString *, uint32_t) const { notImplemented(); - return 0; } uint32_t NotImplementedAttribute::get(DocId, WeightedConstChar *, uint32_t) const { notImplemented(); - return 0; } uint32_t NotImplementedAttribute::get(DocId, WeightedEnum *, uint32_t) const { notImplemented(); - return 0; } bool NotImplementedAttribute::findEnum(const char *, EnumHandle &) const { notImplemented(); - return false; } std::vector<NotImplementedAttribute::EnumHandle> NotImplementedAttribute::findFoldedEnums(const char *) const { notImplemented(); - return std::vector<EnumHandle>(); } long NotImplementedAttribute::onSerializeForAscendingSort(DocId, void *, long, const common::BlobConverter *) const { notImplemented(); - return 0; } long NotImplementedAttribute::onSerializeForDescendingSort(DocId, void *, long, const common::BlobConverter *) const { notImplemented(); - return 0; } uint32_t NotImplementedAttribute::clearDoc(DocId) { notImplemented(); - return 0; } uint32_t NotImplementedAttribute::getEnum(DocId) const { notImplemented(); - return 0; } bool NotImplementedAttribute::addDoc(DocId &) { notImplemented(); - return false; } std::unique_ptr<SearchContext> NotImplementedAttribute::getSearch(QueryTermSimpleUP, const attribute::SearchContextParams &) const { notImplemented(); - return {}; } void NotImplementedAttribute::onAddDocs(DocId ) { } diff --git a/searchlib/src/vespa/searchlib/attribute/numericbase.cpp b/searchlib/src/vespa/searchlib/attribute/numericbase.cpp index 84e7cd841f4..d59616c5965 100644 --- a/searchlib/src/vespa/searchlib/attribute/numericbase.cpp +++ b/searchlib/src/vespa/searchlib/attribute/numericbase.cpp @@ -8,8 +8,6 @@ LOG_SETUP(".searchlib.attribute.numericbase"); namespace search { -IMPLEMENT_IDENTIFIABLE_ABSTRACT(NumericAttribute, AttributeVector); - void NumericAttribute::load_enumerated_data(ReaderBase&, enumstore::EnumeratedPostingsLoader&, diff --git a/searchlib/src/vespa/searchlib/attribute/numericbase.h b/searchlib/src/vespa/searchlib/attribute/numericbase.h index 91f50fc2961..f19ddcca706 100644 --- a/searchlib/src/vespa/searchlib/attribute/numericbase.h +++ b/searchlib/src/vespa/searchlib/attribute/numericbase.h @@ -24,9 +24,6 @@ protected: virtual void load_enumerated_data(ReaderBase& attrReader, enumstore::EnumeratedLoader& loader); virtual void load_posting_lists_and_update_enum_store(enumstore::EnumeratedPostingsLoader& loader); bool onAddDoc(DocId) override { return true; } - -public: - DECLARE_IDENTIFIABLE_ABSTRACT(NumericAttribute); }; } // namespace search diff --git a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp index ae10c07d12f..29f04ebab27 100644 --- a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp @@ -288,6 +288,4 @@ PredicateAttribute::updateValue(uint32_t doc_id, const PredicateFieldValue &valu assert(result.interval_range > 0); } -IMPLEMENT_IDENTIFIABLE_ABSTRACT(PredicateAttribute, AttributeVector); - } // namespace search diff --git a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.h b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.h index 0474513d5f4..f5d789298a0 100644 --- a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.h +++ b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.h @@ -38,8 +38,6 @@ public: using IntervalRange = uint16_t; using IntervalRangeVector = vespalib::RcuVectorBase<IntervalRange>; - DECLARE_IDENTIFIABLE_ABSTRACT(PredicateAttribute); - PredicateAttribute(const vespalib::string &base_file_name); PredicateAttribute(const vespalib::string &base_file_name, const Config &config); diff --git a/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp index 9c12293c22a..7ff04f789b2 100644 --- a/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp @@ -511,8 +511,6 @@ ReferenceAttribute::getSearch(QueryTermSimpleUP term, const attribute::SearchCon return std::make_unique<ReferenceSearchContext>(*this, gid); } -IMPLEMENT_IDENTIFIABLE_ABSTRACT(ReferenceAttribute, AttributeVector); - } namespace vespalib::datastore { diff --git a/searchlib/src/vespa/searchlib/attribute/reference_attribute.h b/searchlib/src/vespa/searchlib/attribute/reference_attribute.h index 97ca0660092..dc3e2ad729a 100644 --- a/searchlib/src/vespa/searchlib/attribute/reference_attribute.h +++ b/searchlib/src/vespa/searchlib/attribute/reference_attribute.h @@ -69,7 +69,6 @@ private: public: using SP = std::shared_ptr<ReferenceAttribute>; - DECLARE_IDENTIFIABLE_ABSTRACT(ReferenceAttribute); ReferenceAttribute(const vespalib::stringref baseFileName); ReferenceAttribute(const vespalib::stringref baseFileName, const Config & cfg); ~ReferenceAttribute() override; diff --git a/searchlib/src/vespa/searchlib/attribute/stringbase.cpp b/searchlib/src/vespa/searchlib/attribute/stringbase.cpp index 973f468a23e..48321747fc3 100644 --- a/searchlib/src/vespa/searchlib/attribute/stringbase.cpp +++ b/searchlib/src/vespa/searchlib/attribute/stringbase.cpp @@ -17,8 +17,6 @@ LOG_SETUP(".searchlib.attribute.stringbase"); namespace search { -IMPLEMENT_IDENTIFIABLE_ABSTRACT(StringAttribute, AttributeVector); - size_t StringAttribute::countZero(const char * bt, size_t sz) { diff --git a/searchlib/src/vespa/searchlib/attribute/stringbase.h b/searchlib/src/vespa/searchlib/attribute/stringbase.h index d282b3b0e33..b1e55c3d640 100644 --- a/searchlib/src/vespa/searchlib/attribute/stringbase.h +++ b/searchlib/src/vespa/searchlib/attribute/stringbase.h @@ -25,9 +25,8 @@ public: using EnumVector = IEnumStore::EnumVector; using LoadedValueType = const char*; using LoadedVector = NoLoadedVector; - using OffsetVector = vespalib::Array<uint32_t>; + using OffsetVector = std::vector<uint32_t, vespalib::allocator_large<uint32_t>>; public: - DECLARE_IDENTIFIABLE_ABSTRACT(StringAttribute); bool append(DocId doc, const vespalib::string & v, int32_t weight) { return AttributeVector::append(_changes, doc, StringChangeData(v), weight); } diff --git a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp index cb15b877311..8c03800b92a 100644 --- a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp @@ -8,6 +8,7 @@ #include <vespa/searchlib/fef/termfieldmatchdataarray.h> #include <vespa/searchlib/tensor/dense_tensor_attribute.h> #include <vespa/searchlib/tensor/distance_function_factory.h> +#include <vespa/vespalib/objects/objectvisitor.h> #include <vespa/log/log.h> LOG_SETUP(".searchlib.queryeval.nearest_neighbor_blueprint"); diff --git a/searchlib/src/vespa/searchlib/queryeval/sourceblendersearch.cpp b/searchlib/src/vespa/searchlib/queryeval/sourceblendersearch.cpp index 8357d403000..3d6f9669456 100644 --- a/searchlib/src/vespa/searchlib/queryeval/sourceblendersearch.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/sourceblendersearch.cpp @@ -2,6 +2,7 @@ #include "sourceblendersearch.h" #include "isourceselector.h" +#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/objects/visit.hpp> #include <vespa/vespalib/util/array.hpp> diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp index c836ac6bd5b..add5184c4eb 100644 --- a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp +++ b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp @@ -317,6 +317,4 @@ TensorAttribute::distance_metric() const { return getConfig().distance_metric(); } -IMPLEMENT_IDENTIFIABLE_ABSTRACT(TensorAttribute, AttributeVector); - } diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.h b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.h index 505e072fa31..ae6a4a302ea 100644 --- a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.h +++ b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.h @@ -41,7 +41,6 @@ protected: EntryRef acquire_entry_ref(DocId doc_id) const noexcept { return _refVector.acquire_elem_ref(doc_id).load_acquire(); } public: - DECLARE_IDENTIFIABLE_ABSTRACT(TensorAttribute); using RefCopyVector = vespalib::Array<EntryRef>; TensorAttribute(vespalib::stringref name, const Config &cfg, TensorStore &tensorStore); ~TensorAttribute() override; |