diff options
100 files changed, 426 insertions, 264 deletions
diff --git a/ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp b/ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp index c62f140d944..4af30a5d9d3 100644 --- a/ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp +++ b/ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp @@ -7,6 +7,7 @@ #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/tensor/dense_tensor_attribute.h> #include <vespa/searchlib/tensor/nearest_neighbor_index.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/eval/eval/value.h> #include <vespa/vespalib/test/insertion_operators.h> #include <ostream> diff --git a/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp b/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp index cbc345f68d8..b16f7810cca 100644 --- a/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp @@ -93,7 +93,7 @@ struct Fixture vespalib::ThreadStackExecutor _executor; Fixture(); ~Fixture(); - std::unique_ptr<AttributeInitializer> createInitializer(const AttributeSpec &spec, SerialNum serialNum); + std::unique_ptr<AttributeInitializer> createInitializer(AttributeSpec && spec, SerialNum serialNum); }; Fixture::Fixture() @@ -107,9 +107,9 @@ Fixture::Fixture() Fixture::~Fixture() = default; std::unique_ptr<AttributeInitializer> -Fixture::createInitializer(const AttributeSpec &spec, SerialNum serialNum) +Fixture::createInitializer(AttributeSpec &&spec, SerialNum serialNum) { - return std::make_unique<AttributeInitializer>(_diskLayout->createAttributeDir(spec.getName()), "test.subdb", spec, serialNum, _factory, _executor); + return std::make_unique<AttributeInitializer>(_diskLayout->createAttributeDir(spec.getName()), "test.subdb", std::move(spec), serialNum, _factory, _executor); } TEST("require that integer attribute can be initialized") diff --git a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp index 7b0451d0f9d..2b3f1c56ae1 100644 --- a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp @@ -1,9 +1,5 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/config-attributes.h> -#include <vespa/fastos/file.h> -#include <vespa/searchcommon/attribute/i_attribute_functor.h> -#include <vespa/searchcommon/attribute/iattributevector.h> #include <vespa/searchcore/proton/attribute/attribute_collection_spec_factory.h> #include <vespa/searchcore/proton/attribute/attribute_manager_initializer.h> #include <vespa/searchcore/proton/attribute/attribute_writer.h> @@ -33,11 +29,15 @@ #include <vespa/searchlib/predicate/predicate_tree_annotator.h> #include <vespa/searchlib/test/directory_handler.h> #include <vespa/searchlib/test/mock_gid_to_lid_mapping.h> +#include <vespa/searchcommon/attribute/i_attribute_functor.h> +#include <vespa/searchcommon/attribute/iattributevector.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/foreground_thread_executor.h> #include <vespa/vespalib/util/foregroundtaskexecutor.h> #include <vespa/vespalib/util/size_literals.h> #include <vespa/vespalib/util/threadstackexecutor.h> +#include <vespa/config-attributes.h> +#include <vespa/fastos/file.h> #include <vespa/log/log.h> LOG_SETUP("attribute_manager_test"); @@ -215,10 +215,9 @@ struct SequentialAttributeManager { SequentialAttributesInitializer initializer; proton::AttributeManager mgr; - SequentialAttributeManager(const AttributeManager &currMgr, - const AttrMgrSpec &newSpec) + SequentialAttributeManager(const AttributeManager &currMgr, AttrMgrSpec && newSpec) : initializer(newSpec.getDocIdLimit()), - mgr(currMgr, newSpec, initializer) + mgr(currMgr, std::move(newSpec), initializer) { mgr.addInitializedAttributes(initializer.getInitializedAttributes()); } @@ -447,7 +446,7 @@ TEST_F("require that reconfig can add attributes", Fixture) newSpec.push_back(AttributeSpec("a2", INT32_SINGLE)); newSpec.push_back(AttributeSpec("a3", INT32_SINGLE)); - SequentialAttributeManager sam(f._m, AttrMgrSpec(newSpec, f._m.getNumDocs(), 10)); + SequentialAttributeManager sam(f._m, AttrMgrSpec(std::move(newSpec), f._m.getNumDocs(), 10)); std::vector<AttributeGuard> list; sam.mgr.getAttributeList(list); std::sort(list.begin(), list.end(), [](const AttributeGuard & a, const AttributeGuard & b) { @@ -470,7 +469,7 @@ TEST_F("require that reconfig can remove attributes", Fixture) AttrSpecList newSpec; newSpec.push_back(AttributeSpec("a2", INT32_SINGLE)); - SequentialAttributeManager sam(f._m, AttrMgrSpec(newSpec, 1, 10)); + SequentialAttributeManager sam(f._m, AttrMgrSpec(std::move(newSpec), 1, 10)); std::vector<AttributeGuard> list; sam.mgr.getAttributeList(list); EXPECT_EQUAL(1u, list.size()); @@ -493,7 +492,7 @@ TEST_F("require that new attributes after reconfig are initialized", Fixture) newSpec.push_back(AttributeSpec("a2", INT32_SINGLE)); newSpec.push_back(AttributeSpec("a3", INT32_ARRAY)); - SequentialAttributeManager sam(f._m, AttrMgrSpec(newSpec, 3, 4)); + SequentialAttributeManager sam(f._m, AttrMgrSpec(std::move(newSpec), 3, 4)); AttributeGuard::UP a2ap = sam.mgr.getAttribute("a2"); AttributeGuard &a2(*a2ap); EXPECT_EQUAL(3u, a2->getNumDocs()); @@ -519,13 +518,13 @@ TEST_F("require that removed attributes cannot resurrect", BaseFixture) } AttrSpecList ns1; - SequentialAttributeManager am2(*am1, AttrMgrSpec(ns1, 3, 16)); + SequentialAttributeManager am2(*am1, AttrMgrSpec(std::move(ns1), 3, 16)); am1.reset(); AttrSpecList ns2; ns2.push_back(AttributeSpec("a1", INT32_SINGLE)); // 2 new documents added since a1 was removed - SequentialAttributeManager am3(am2.mgr, AttrMgrSpec(ns2, 5, 20)); + SequentialAttributeManager am3(am2.mgr, AttrMgrSpec(std::move(ns2), 5, 20)); AttributeGuard::UP ag1ap = am3.mgr.getAttribute("a1"); AttributeGuard &ag1(*ag1ap); @@ -545,7 +544,7 @@ TEST_F("require that extra attribute is not treated as removed", Fixture) ex->commit(CommitParam(1)); AttrSpecList ns; - SequentialAttributeManager am2(f._m, AttrMgrSpec(ns, 2, 1)); + SequentialAttributeManager am2(f._m, AttrMgrSpec(std::move(ns), 2, 1)); EXPECT_TRUE(am2.mgr.getAttribute("ex")->operator->() == ex.get()); // reuse } @@ -558,7 +557,7 @@ TEST_F("require that removed fields can be pruned", Fixture) AttrSpecList newSpec; newSpec.push_back(AttributeSpec("a2", INT32_SINGLE)); - SequentialAttributeManager sam(f._m, AttrMgrSpec(newSpec, 1, 11)); + SequentialAttributeManager sam(f._m, AttrMgrSpec(std::move(newSpec), 1, 11)); sam.mgr.pruneRemovedFields(11); FastOS_StatInfo si; @@ -690,7 +689,7 @@ TEST_F("require that attributes can be initialized and loaded in sequence", Base newSpec.push_back(AttributeSpec("a2", INT32_SINGLE)); newSpec.push_back(AttributeSpec("a3", INT32_SINGLE)); - SequentialAttributeManager newMgr(amf._m, AttrMgrSpec(newSpec, 10, createSerialNum + 5)); + SequentialAttributeManager newMgr(amf._m, AttrMgrSpec(std::move(newSpec), 10, createSerialNum + 5)); AttributeGuard::UP a1 = newMgr.mgr.getAttribute("a1"); TEST_DO(validateAttribute(*a1->get())); @@ -819,7 +818,7 @@ TEST_F("require that attribute vector of wrong type is dropped", BaseFixture) newSpec.push_back(AttributeSpec("a4", dense_tensor)); newSpec.push_back(AttributeSpec("a5", predicate)); newSpec.push_back(AttributeSpec("a6", predicate2)); - SequentialAttributeManager am2(*am1, AttrMgrSpec(newSpec, 5, 20)); + SequentialAttributeManager am2(*am1, AttrMgrSpec(std::move(newSpec), 5, 20)); TEST_DO(assertCreateSerialNum(*am1, "a1", 1)); TEST_DO(assertCreateSerialNum(*am1, "a2", 2)); TEST_DO(assertCreateSerialNum(*am1, "a3", 3)); @@ -861,7 +860,7 @@ TEST_F("require that shrink flushtarget is handed over to new attribute manager" am1->addAttribute({"a1", INT32_SINGLE}, 4); AttrSpecList newSpec; newSpec.push_back(AttributeSpec("a1", INT32_SINGLE)); - auto am2 = am1->create(AttrMgrSpec(newSpec, 5, 20)); + auto am2 = am1->create(AttrMgrSpec(std::move(newSpec), 5, 20)); auto am3 = std::dynamic_pointer_cast<AttributeManager>(am2); TEST_DO(assertShrinkTargetSerial(*am3, "a1", 3)); EXPECT_EQUAL(am1->getShrinker("a1"), am3->getShrinker("a1")); diff --git a/searchcore/src/tests/proton/attribute/attribute_test.cpp b/searchcore/src/tests/proton/attribute/attribute_test.cpp index de6b923bdc1..bcce3b8d07a 100644 --- a/searchcore/src/tests/proton/attribute/attribute_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_test.cpp @@ -555,8 +555,7 @@ public: attr.fastaccess = fastAccess; _builder.attribute.push_back(attr); } - AttributeCollectionSpec::UP create(uint32_t docIdLimit, - search::SerialNum serialNum) { + std::unique_ptr<AttributeCollectionSpec> create(uint32_t docIdLimit, search::SerialNum serialNum) { return _factory.create(_builder, docIdLimit, serialNum); } }; @@ -573,7 +572,7 @@ struct FastAccessAttributeCollectionSpecTest : public AttributeCollectionSpecTes TEST_F(NormalAttributeCollectionSpecTest, spec_can_be_created) { - AttributeCollectionSpec::UP spec = create(10, 20); + auto spec = create(10, 20); EXPECT_EQ(2u, spec->getAttributes().size()); EXPECT_EQ("a1", spec->getAttributes()[0].getName()); EXPECT_EQ("a2", spec->getAttributes()[1].getName()); @@ -583,7 +582,7 @@ TEST_F(NormalAttributeCollectionSpecTest, spec_can_be_created) TEST_F(FastAccessAttributeCollectionSpecTest, spec_can_be_created) { - AttributeCollectionSpec::UP spec = create(10, 20); + auto spec = create(10, 20); EXPECT_EQ(1u, spec->getAttributes().size()); EXPECT_EQ("a2", spec->getAttributes()[0].getName()); EXPECT_EQ(10u, spec->getDocIdLimit()); @@ -594,13 +593,13 @@ const FilterAttributeManager::AttributeSet ACCEPTED_ATTRIBUTES = {"a2"}; class FilterAttributeManagerTest : public ::testing::Test { public: - DirectoryHandler _dirHandler; - DummyFileHeaderContext _fileHeaderContext; - ForegroundTaskExecutor _attributeFieldWriter; - ForegroundThreadExecutor _shared; - HwInfo _hwInfo; + DirectoryHandler _dirHandler; + DummyFileHeaderContext _fileHeaderContext; + ForegroundTaskExecutor _attributeFieldWriter; + ForegroundThreadExecutor _shared; + HwInfo _hwInfo; proton::AttributeManager::SP _baseMgr; - FilterAttributeManager _filterMgr; + FilterAttributeManager _filterMgr; FilterAttributeManagerTest() : _dirHandler(test_dir), diff --git a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp index 0dab0710209..ab7a0db5e7b 100644 --- a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp +++ b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp @@ -13,6 +13,7 @@ #include <vespa/searchlib/common/indexmetainfo.h> #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/searchlib/test/directory_handler.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/datastore/datastorebase.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/testkit/testapp.h> diff --git a/searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp b/searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp index 2815bd7d88e..b08764289e6 100644 --- a/searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp +++ b/searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp @@ -1,11 +1,12 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/testkit/testapp.h> -#include <vespa/searchcommon/common/schema.h> #include <vespa/searchcore/proton/attribute/document_field_populator.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/integerbase.h> #include <vespa/searchlib/index/docbuilder.h> +#include <vespa/searchcommon/common/schema.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/log/log.h> diff --git a/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp b/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp index 996ddac2d2a..0a6c38b4209 100644 --- a/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp +++ b/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp @@ -12,6 +12,7 @@ #include <vespa/searchlib/attribute/imported_attribute_vector_factory.h> #include <vespa/searchlib/attribute/reference_attribute.h> #include <vespa/searchlib/test/mock_gid_to_lid_mapping.h> +#include <vespa/searchcommon/attribute/config.h> #include <future> #include <vespa/log/log.h> diff --git a/searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp b/searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp index 8fa5c2994b0..2d7e242b9fb 100644 --- a/searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp +++ b/searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp @@ -1,5 +1,12 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/searchcore/proton/common/attribute_updater.h> +#include <vespa/searchlib/attribute/attributefactory.h> +#include <vespa/searchlib/attribute/reference_attribute.h> +#include <vespa/searchlib/tensor/dense_tensor_attribute.h> +#include <vespa/searchlib/tensor/serialized_fast_value_attribute.h> +#include <vespa/searchlib/test/weighted_type_test_utils.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/document/base/testdocrepo.h> #include <vespa/document/datatype/tensor_data_type.h> #include <vespa/document/fieldvalue/arrayfieldvalue.h> @@ -26,12 +33,6 @@ #include <vespa/eval/eval/tensor_spec.h> #include <vespa/eval/eval/value.h> #include <vespa/eval/eval/value_codec.h> -#include <vespa/searchcore/proton/common/attribute_updater.h> -#include <vespa/searchlib/attribute/attributefactory.h> -#include <vespa/searchlib/attribute/reference_attribute.h> -#include <vespa/searchlib/tensor/dense_tensor_attribute.h> -#include <vespa/searchlib/tensor/serialized_fast_value_attribute.h> -#include <vespa/searchlib/test/weighted_type_test_utils.h> #include <vespa/vespalib/stllike/hash_map.hpp> #include <vespa/vespalib/testkit/testapp.h> diff --git a/searchcore/src/tests/proton/common/selectpruner_test.cpp b/searchcore/src/tests/proton/common/selectpruner_test.cpp index c8c474e21bc..3cb8389a4ea 100644 --- a/searchcore/src/tests/proton/common/selectpruner_test.cpp +++ b/searchcore/src/tests/proton/common/selectpruner_test.cpp @@ -1,16 +1,16 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vespalib/stllike/string.h> -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/document/config/documenttypes_config_fwd.h> + +#include <vespa/searchcore/proton/common/selectpruner.h> +#include <vespa/searchlib/attribute/attributefactory.h> +#include <vespa/searchlib/test/mock_attribute_manager.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/document/repo/configbuilder.h> #include <vespa/document/repo/documenttyperepo.h> #include <vespa/document/datatype/documenttype.h> -#include <vespa/searchcore/proton/common/selectpruner.h> #include <vespa/document/select/parser.h> #include <vespa/document/select/cloningvisitor.h> #include <vespa/document/fieldvalue/document.h> -#include <vespa/searchlib/attribute/attributefactory.h> -#include <vespa/searchlib/test/mock_attribute_manager.h> +#include <vespa/vespalib/testkit/testapp.h> #include <vespa/log/log.h> LOG_SETUP("selectpruner_test"); diff --git a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp index a460c65fbb2..f89af9a11a6 100644 --- a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp +++ b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp @@ -1,5 +1,13 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/searchcore/proton/common/attribute_updater.h> +#include <vespa/searchcore/proton/common/pendinglidtracker.h> +#include <vespa/searchcore/proton/persistenceengine/document_iterator.h> +#include <vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.h> +#include <vespa/searchlib/attribute/attributecontext.h> +#include <vespa/searchlib/attribute/attributefactory.h> +#include <vespa/searchlib/test/mock_attribute_manager.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/document/fieldset/fieldsets.h> #include <vespa/document/fieldvalue/fieldvalues.h> #include <vespa/document/datatype/documenttype.h> @@ -8,13 +16,6 @@ #include <vespa/persistence/spi/docentry.h> #include <vespa/persistence/spi/result.h> #include <vespa/persistence/spi/test.h> -#include <vespa/searchcore/proton/common/attribute_updater.h> -#include <vespa/searchcore/proton/common/pendinglidtracker.h> -#include <vespa/searchcore/proton/persistenceengine/document_iterator.h> -#include <vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.h> -#include <vespa/searchlib/attribute/attributecontext.h> -#include <vespa/searchlib/attribute/attributefactory.h> -#include <vespa/searchlib/test/mock_attribute_manager.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/testkit/test_kit.h> #include <unordered_set> diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp index d4e337f2717..948c9cfe25e 100644 --- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp +++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp @@ -455,11 +455,11 @@ asAttributeManager(const proton::IAttributeManager::SP &attrMgr) TEST_F("require that we can reconfigure attribute manager", Fixture) { ViewPtrs o = f._views.getViewPtrs(); - AttributeCollectionSpec::AttributeList specList; - AttributeCollectionSpec spec(specList, 1, 0); ReconfigParams params(CCR().setAttributesChanged(true).setSchemaChanged(true)); // Use new config snapshot == old config snapshot (only relevant for reprocessing) - f._configurer->reconfigure(*createConfig(), *createConfig(), spec, params, f._resolver); + f._configurer->reconfigure(*createConfig(), *createConfig(), + AttributeCollectionSpec(AttributeCollectionSpec::AttributeList(), 1, 0), + params, f._resolver); ViewPtrs n = f._views.getViewPtrs(); { // verify search view @@ -494,11 +494,11 @@ void checkAttributeWriterChangeOnRepoChange(Fixture &f, bool docTypeRepoChanged) { auto oldAttributeWriter = getAttributeWriter(f); - AttributeCollectionSpec::AttributeList specList; - AttributeCollectionSpec spec(specList, 1, 0); ReconfigParams params(CCR().setDocumentTypeRepoChanged(docTypeRepoChanged)); // Use new config snapshot == old config snapshot (only relevant for reprocessing) - f._configurer->reconfigure(*createConfig(), *createConfig(), spec, params, f._resolver); + f._configurer->reconfigure(*createConfig(), *createConfig(), + AttributeCollectionSpec(AttributeCollectionSpec::AttributeList(), 1, 0), + params, f._resolver); auto newAttributeWriter = getAttributeWriter(f); if (docTypeRepoChanged) { EXPECT_NOT_EQUAL(oldAttributeWriter, newAttributeWriter); @@ -515,11 +515,11 @@ TEST_F("require that we get new attribute writer if document type repo changes", TEST_F("require that reconfigure returns reprocessing initializer when changing attributes", Fixture) { - AttributeCollectionSpec::AttributeList specList; - AttributeCollectionSpec spec(specList, 1, 0); ReconfigParams params(CCR().setAttributesChanged(true).setSchemaChanged(true)); IReprocessingInitializer::UP init = - f._configurer->reconfigure(*createConfig(), *createConfig(), spec, params, f._resolver); + f._configurer->reconfigure(*createConfig(), *createConfig(), + AttributeCollectionSpec(AttributeCollectionSpec::AttributeList(), 1, 0), + params, f._resolver); EXPECT_TRUE(init.get() != nullptr); EXPECT_TRUE((dynamic_cast<AttributeReprocessingInitializer *>(init.get())) != nullptr); @@ -528,10 +528,9 @@ TEST_F("require that reconfigure returns reprocessing initializer when changing TEST_F("require that we can reconfigure attribute writer", FastAccessFixture) { - AttributeCollectionSpec::AttributeList specList; - AttributeCollectionSpec spec(specList, 1, 0); FastAccessFeedView::SP o = f._view._feedView.get(); - f._configurer.reconfigure(*createConfig(), *createConfig(), spec); + f._configurer.reconfigure(*createConfig(), *createConfig(), + AttributeCollectionSpec(AttributeCollectionSpec::AttributeList(), 1, 0)); FastAccessFeedView::SP n = f._view._feedView.get(); FastAccessFeedViewComparer cmp(o, n); @@ -543,10 +542,8 @@ TEST_F("require that we can reconfigure attribute writer", FastAccessFixture) TEST_F("require that reconfigure returns reprocessing initializer", FastAccessFixture) { - AttributeCollectionSpec::AttributeList specList; - AttributeCollectionSpec spec(specList, 1, 0); - IReprocessingInitializer::UP init = - f._configurer.reconfigure(*createConfig(), *createConfig(), spec); + IReprocessingInitializer::UP init = f._configurer.reconfigure(*createConfig(), *createConfig(), + AttributeCollectionSpec(AttributeCollectionSpec::AttributeList(), 1, 0)); EXPECT_TRUE(init.get() != nullptr); EXPECT_TRUE((dynamic_cast<AttributeReprocessingInitializer *>(init.get())) != nullptr); diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp index 5018b203216..adf0dbf4dcf 100644 --- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp @@ -21,6 +21,7 @@ #include <vespa/searchcore/proton/test/threading_service_observer.h> #include <vespa/searchcore/proton/test/transport_helper.h> #include <vespa/searchlib/attribute/attributefactory.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/document/update/documentupdate.h> #include <vespa/document/datatype/documenttype.h> #include <vespa/vespalib/util/destructor_callbacks.h> diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp index 73311c110a9..9a2655cdd8a 100644 --- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp @@ -11,6 +11,7 @@ #include <vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h> #include <vespa/searchcore/proton/server/itlssyncer.h> #include <vespa/searchlib/attribute/attributefilesavetarget.h> +#include <vespa/searchlib/attribute/search_context.h> #include <vespa/searchlib/common/flush_token.h> #include <vespa/searchlib/common/tunefileinfo.h> #include <vespa/searchlib/fef/matchdatalayout.h> diff --git a/searchcore/src/tests/proton/reference/document_db_reference/document_db_reference_test.cpp b/searchcore/src/tests/proton/reference/document_db_reference/document_db_reference_test.cpp index aba27827d56..526b0837212 100644 --- a/searchcore/src/tests/proton/reference/document_db_reference/document_db_reference_test.cpp +++ b/searchcore/src/tests/proton/reference/document_db_reference/document_db_reference_test.cpp @@ -1,11 +1,13 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vespalib/testkit/testapp.h> + #include <vespa/searchcore/proton/attribute/imported_attributes_repo.h> #include <vespa/searchcore/proton/reference/document_db_reference.h> #include <vespa/searchcore/proton/test/mock_attribute_manager.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/imported_attribute_vector.h> - +#include <vespa/searchcommon/attribute/config.h> +#include <vespa/vespalib/testkit/testapp.h> +#include <cassert> #include <vespa/log/log.h> LOG_SETUP("document_db_reference_test"); diff --git a/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp b/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp index 061a3fd4c32..4ee245c697d 100644 --- a/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp +++ b/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp @@ -1,10 +1,5 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/config-imported-fields.h> -#include <vespa/document/datatype/documenttype.h> -#include <vespa/document/datatype/referencedatatype.h> -#include <vespa/log/log.h> #include <vespa/searchcore/proton/attribute/imported_attributes_repo.h> #include <vespa/searchcore/proton/reference/document_db_reference_resolver.h> #include <vespa/searchcore/proton/reference/gid_to_lid_change_listener.h> @@ -18,11 +13,17 @@ #include <vespa/searchlib/attribute/reference_attribute.h> #include <vespa/searchlib/common/i_gid_to_lid_mapper.h> #include <vespa/searchlib/common/i_gid_to_lid_mapper_factory.h> +#include <vespa/searchlib/test/mock_attribute_manager.h> +#include <vespa/searchcommon/attribute/config.h> +#include <vespa/document/datatype/documenttype.h> +#include <vespa/document/datatype/referencedatatype.h> #include <vespa/vespalib/util/monitored_refcount.h> #include <vespa/vespalib/util/sequencedtaskexecutor.h> -#include <vespa/searchlib/test/mock_attribute_manager.h> #include <vespa/vespalib/test/insertion_operators.h> +#include <vespa/vespalib/testkit/testapp.h> +#include <vespa/config-imported-fields.h> +#include <vespa/log/log.h> LOG_SETUP("document_db_reference_resolver_test"); using namespace document; diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp index e3b1fd3aa15..dd33e34efdd 100644 --- a/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp +++ b/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp @@ -57,7 +57,7 @@ struct Fixture std::unique_ptr<GidToLidChangeListener> _listener; Fixture() - : _attr(std::make_shared<ReferenceAttribute>("test", Config(BasicType::REFERENCE))), + : _attr(std::make_shared<ReferenceAttribute>("test")), _writer(vespalib::SequencedTaskExecutor::create(test_executor, 1)), _refCount(), _listener() diff --git a/searchcore/src/tests/proton/server/documentretriever_test.cpp b/searchcore/src/tests/proton/server/documentretriever_test.cpp index f5c163fefb5..bf277f86367 100644 --- a/searchcore/src/tests/proton/server/documentretriever_test.cpp +++ b/searchcore/src/tests/proton/server/documentretriever_test.cpp @@ -1,6 +1,21 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. // Unit tests for documentretriever. +#include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h> +#include <vespa/searchcore/proton/server/documentretriever.h> +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> +#include <vespa/searchcore/proton/test/dummy_document_store.h> +#include <vespa/searchlib/attribute/attributefactory.h> +#include <vespa/searchlib/attribute/attributeguard.h> +#include <vespa/searchlib/attribute/attributemanager.h> +#include <vespa/searchlib/attribute/floatbase.h> +#include <vespa/searchlib/attribute/integerbase.h> +#include <vespa/searchlib/attribute/predicate_attribute.h> +#include <vespa/searchlib/attribute/stringbase.h> +#include <vespa/searchlib/predicate/predicate_index.h> +#include <vespa/searchlib/tensor/tensor_attribute.h> +#include <vespa/searchcommon/attribute/config.h> +#include <vespa/searchcommon/common/schema.h> #include <vespa/document/base/documentid.h> #include <vespa/document/bucket/bucketid.h> #include <vespa/document/datatype/datatype.h> @@ -21,29 +36,15 @@ #include <vespa/document/repo/configbuilder.h> #include <vespa/document/repo/documenttyperepo.h> #include <vespa/document/test/fieldvalue_helpers.h> +#include <vespa/vespalib/geo/zcurve.h> +#include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/util/stringfmt.h> #include <vespa/eval/eval/simple_value.h> #include <vespa/eval/eval/tensor_spec.h> #include <vespa/eval/eval/value.h> #include <vespa/eval/eval/test/value_compare.h> #include <vespa/persistence/spi/bucket.h> #include <vespa/persistence/spi/test.h> -#include <vespa/searchcommon/common/schema.h> -#include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h> -#include <vespa/searchcore/proton/server/documentretriever.h> -#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> -#include <vespa/searchcore/proton/test/dummy_document_store.h> -#include <vespa/searchlib/attribute/attributefactory.h> -#include <vespa/searchlib/attribute/attributeguard.h> -#include <vespa/searchlib/attribute/attributemanager.h> -#include <vespa/searchlib/attribute/floatbase.h> -#include <vespa/searchlib/attribute/integerbase.h> -#include <vespa/searchlib/attribute/predicate_attribute.h> -#include <vespa/searchlib/attribute/stringbase.h> -#include <vespa/searchlib/predicate/predicate_index.h> -#include <vespa/searchlib/tensor/tensor_attribute.h> -#include <vespa/vespalib/geo/zcurve.h> -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/vespalib/util/stringfmt.h> #include <vespa/log/log.h> diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_aspect_delayer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_aspect_delayer.cpp index 78603512d6b..6e935a577fd 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_aspect_delayer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_aspect_delayer.cpp @@ -9,6 +9,7 @@ #include <vespa/searchcore/proton/common/i_document_type_inspector.h> #include <vespa/searchcore/proton/common/i_indexschema_inspector.h> #include <vespa/searchlib/attribute/configconverter.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/stllike/hash_set.hpp> using search::attribute::isUpdateableInMemoryOnly; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_initializer.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_initializer.h index cd2e044dee6..99b6b026f8f 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_initializer.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_initializer.h @@ -20,17 +20,17 @@ namespace proton { class AttributeManagerInitializer : public initializer::InitializerTask { private: - search::SerialNum _configSerialNum; - DocumentMetaStore::SP _documentMetaStore; - AttributeManager::SP _attrMgr; + search::SerialNum _configSerialNum; + DocumentMetaStore::SP _documentMetaStore; + AttributeManager::SP _attrMgr; vespa::config::search::AttributesConfig _attrCfg; - AllocStrategy _alloc_strategy; - bool _fastAccessAttributesOnly; - searchcorespi::index::IThreadService &_master; - InitializedAttributesResult _attributesResult; - std::shared_ptr<AttributeManager::SP> _attrMgrResult; + AllocStrategy _alloc_strategy; + bool _fastAccessAttributesOnly; + searchcorespi::index::IThreadService &_master; + InitializedAttributesResult _attributesResult; + std::shared_ptr<AttributeManager::SP> _attrMgrResult; - AttributeCollectionSpec::UP createAttributeSpec() const; + std::unique_ptr<AttributeCollectionSpec> createAttributeSpec() const; public: AttributeManagerInitializer(search::SerialNum configSerialNum, @@ -44,7 +44,7 @@ public: std::shared_ptr<AttributeManager::SP> attrMgrResult); ~AttributeManagerInitializer() override; - virtual void run() override; + void run() override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.cpp index 10e8947c38a..d47d2dd2877 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.cpp @@ -7,6 +7,7 @@ #include <vespa/vespalib/util/destructor_callbacks.h> #include <vespa/vespalib/util/gate.h> #include <vespa/searchlib/attribute/attributevector.h> +#include <cassert> #include <vespa/log/log.h> LOG_SETUP(".proton.attribute.attribute_populator"); diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp index 5f1a59584e4..bb25b3da7be 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp @@ -9,6 +9,7 @@ #include <vespa/document/fieldvalue/document.h> #include <vespa/document/update/assignvalueupdate.h> #include <vespa/searchcommon/attribute/attribute_utils.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/searchcore/proton/attribute/imported_attributes_repo.h> #include <vespa/searchcore/proton/common/attribute_updater.h> #include <vespa/searchlib/attribute/imported_attribute_vector.h> diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.cpp index cc330bc205c..7fcf541fd02 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.cpp @@ -3,7 +3,7 @@ #include "attributes_initializer_base.h" #include "attributemanager.h" #include <vespa/searchlib/attribute/attributevector.h> - +#include <cassert> namespace proton { void diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.h b/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.h index f249cf637dd..9da268fff21 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.h @@ -4,6 +4,7 @@ #include "i_attribute_initializer_registry.h" #include "attribute_initializer_result.h" +#include <vector> namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.cpp index 7439421ea59..e21230a1d58 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.cpp @@ -3,6 +3,7 @@ #include "attributesconfigscout.h" #include "attribute_type_matcher.h" #include <vespa/searchlib/attribute/configconverter.h> +#include <vespa/searchcommon/attribute/config.h> using search::attribute::ConfigConverter; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp index d074025dc32..b455d8862b5 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp @@ -11,6 +11,7 @@ #include <vespa/searchlib/common/serialnumfileheadercontext.h> #include <vespa/searchlib/attribute/attributememorysavetarget.h> #include <vespa/searchlib/attribute/attributevector.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/util/isequencedtaskexecutor.h> #include <vespa/vespalib/util/stringfmt.h> #include <fstream> diff --git a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp index 8555af7c685..f568e8ed702 100644 --- a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp @@ -6,6 +6,7 @@ #include <vespa/searchlib/attribute/attributevector.h> #include <vespa/searchlib/attribute/attribute_read_guard.h> #include <vespa/vespalib/util/exceptions.h> +#include <cassert> #include <vespa/log/log.h> LOG_SETUP(".proton.common.attribute_field_value_node"); diff --git a/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp b/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp index 342975c7e9f..b0244c34a0f 100644 --- a/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp @@ -9,6 +9,7 @@ #include <vespa/searchlib/attribute/attributevector.h> #include <vespa/searchlib/attribute/attribute_read_guard.h> #include <vespa/searchlib/attribute/iattributemanager.h> +#include <cassert> namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.cpp index 4999c93df8d..57c3159645b 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.cpp @@ -1,6 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "documentmetastoreattribute.h" +#include <vespa/searchcommon/attribute/config.h> namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp index e27bd8706e9..3be9282987c 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp @@ -10,12 +10,15 @@ DocumentMetaStoreContext::ReadGuard::ReadGuard(const search::AttributeVector::SP { } +DocumentMetaStoreContext::DocumentMetaStoreContext(std::shared_ptr<bucketdb::BucketDBOwner> bucketDB) + : DocumentMetaStoreContext(std::move(bucketDB), DocumentMetaStore::getFixedName(), search::GrowStrategy()) +{} DocumentMetaStoreContext::DocumentMetaStoreContext(std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, const vespalib::string &name, - const search::GrowStrategy &grow) : - _metaStoreAttr(std::make_shared<DocumentMetaStore>(std::move(bucketDB), name, grow)), - _metaStore(std::dynamic_pointer_cast<IDocumentMetaStore>(_metaStoreAttr)) + const search::GrowStrategy &grow) + : _metaStoreAttr(std::make_shared<DocumentMetaStore>(std::move(bucketDB), name, grow)), + _metaStore(std::dynamic_pointer_cast<IDocumentMetaStore>(_metaStoreAttr)) { } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h index 6a07d6566cd..c4117f0b751 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h @@ -27,13 +27,14 @@ private: IDocumentMetaStore::SP _metaStore; public: + DocumentMetaStoreContext(std::shared_ptr<bucketdb::BucketDBOwner> bucketDB); /** * Create a new context instantiating a document meta store * with the given name, grow strategy, and comparator. */ DocumentMetaStoreContext(std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, - const vespalib::string &name = DocumentMetaStore::getFixedName(), - const search::GrowStrategy &grow = search::GrowStrategy()); + const vespalib::string &name, + const search::GrowStrategy &grow); ~DocumentMetaStoreContext() override; /** * Create a new context with the given document meta store encapsulated diff --git a/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp b/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp index 8e5e457b80e..294294194f4 100644 --- a/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp @@ -3,6 +3,7 @@ #include "attribute_reprocessing_initializer.h" #include <vespa/searchcore/proton/attribute/attribute_populator.h> #include <vespa/searchcommon/attribute/attribute_utils.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/searchcore/proton/attribute/document_field_populator.h> #include <vespa/searchcore/proton/attribute/filter_attribute_manager.h> #include <vespa/searchcore/proton/common/i_indexschema_inspector.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h index 51c2378789b..d29c71ea43c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h @@ -91,7 +91,7 @@ protected: std::shared_ptr<search::attribute::Interlock> _attribute_interlock; DocIdLimit _docIdLimit; - AttributeCollectionSpec::UP createAttributeSpec(const AttributesConfig &attrCfg, const AllocStrategy& alloc_strategy, SerialNum serialNum) const; + std::unique_ptr<AttributeCollectionSpec> createAttributeSpec(const AttributesConfig &attrCfg, const AllocStrategy& alloc_strategy, SerialNum serialNum) const; AttributeManager::SP getAndResetInitAttributeManager(); virtual IFlushTargetList getFlushTargetsInternal() override; void reconfigureAttributeMetrics(const IAttributeManager &newMgr, const IAttributeManager &oldMgr); diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h index d694d92d0ad..178ed73aef5 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h @@ -15,6 +15,7 @@ #include <vespa/searchcore/proton/persistenceengine/i_document_retriever.h> #include <vespa/searchlib/common/fileheadercontext.h> #include <vespa/vespalib/util/varholder.h> +#include <vespa/vespalib/datastore/compaction_strategy.h> #include <mutex> namespace proton { diff --git a/searchlib/src/apps/tests/document_weight_attribute_lookup_stress_test.cpp b/searchlib/src/apps/tests/document_weight_attribute_lookup_stress_test.cpp index 0fb115a564e..181aaed4117 100644 --- a/searchlib/src/apps/tests/document_weight_attribute_lookup_stress_test.cpp +++ b/searchlib/src/apps/tests/document_weight_attribute_lookup_stress_test.cpp @@ -3,6 +3,7 @@ #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/integerbase.h> #include <vespa/searchlib/attribute/i_document_weight_attribute.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/gtest/gtest.h> #include <random> #include <chrono> 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 ffcb4ca4019..84a4f43cc8e 100644 --- a/searchlib/src/apps/vespa-attribute-inspect/vespa-attribute-inspect.cpp +++ b/searchlib/src/apps/vespa-attribute-inspect/vespa-attribute-inspect.cpp @@ -4,6 +4,7 @@ #include <vespa/searchlib/attribute/attribute.h> #include <vespa/searchlib/attribute/attributeguard.h> #include <vespa/searchlib/attribute/attributefactory.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/data/fileheader.h> #include <fstream> diff --git a/searchlib/src/tests/aggregator/perdocexpr.cpp b/searchlib/src/tests/aggregator/perdocexpr.cpp index 6e3e6bf3353..7bb10433f31 100644 --- a/searchlib/src/tests/aggregator/perdocexpr.cpp +++ b/searchlib/src/tests/aggregator/perdocexpr.cpp @@ -5,6 +5,7 @@ #include <vespa/searchlib/aggregation/perdocexpression.h> #include <vespa/searchlib/attribute/extendableattributes.h> #include <vespa/searchlib/attribute/singleboolattribute.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/objects/objectdumper.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/document/base/testdocman.h> diff --git a/searchlib/src/tests/attribute/attribute_operation/attribute_operation_test.cpp b/searchlib/src/tests/attribute/attribute_operation/attribute_operation_test.cpp index baecb54fbec..7883a497d8b 100644 --- a/searchlib/src/tests/attribute/attribute_operation/attribute_operation_test.cpp +++ b/searchlib/src/tests/attribute/attribute_operation/attribute_operation_test.cpp @@ -4,6 +4,7 @@ #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/attribute.h> #include <vespa/searchlib/common/bitvector.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/log/log.h> diff --git a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp index abdcd27b09a..cb6c66915f1 100644 --- a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp +++ b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp @@ -4,10 +4,10 @@ #include <vespa/searchlib/attribute/attribute.h> #include <vespa/searchlib/attribute/attributeguard.h> #include <vespa/searchlib/attribute/attributefactory.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/fastos/thread.h> #include <vespa/vespalib/util/signalhandler.h> #include <iostream> -#include <fstream> #include "attributesearcher.h" #include "attributeupdater.h" #include <sys/resource.h> diff --git a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp index e34c0f52e41..d4dc8c15f23 100644 --- a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp +++ b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp @@ -14,6 +14,7 @@ #include <vespa/searchlib/test/searchiteratorverifier.h> #include <vespa/searchlib/common/bitvectoriterator.h> #include <vespa/searchlib/parsequery/parse.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/log/log.h> #include <vespa/searchlib/queryeval/executeinfo.h> diff --git a/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp b/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp index fbec89d27eb..c5d70109015 100644 --- a/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp +++ b/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp @@ -4,6 +4,7 @@ #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/attributeguard.h> #include <vespa/searchlib/attribute/integerbase.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/vespalib/util/stringfmt.h> diff --git a/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp b/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp index 5e9626baad7..56fe791021e 100644 --- a/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp +++ b/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp @@ -6,13 +6,11 @@ #include <vespa/searchlib/attribute/attribute_read_guard.h> #include <vespa/searchlib/attribute/attributememorysavetarget.h> #include <vespa/searchlib/attribute/i_document_weight_attribute.h> -#include <vespa/searchlib/attribute/iattributemanager.h> #include <vespa/searchlib/index/dummyfileheadercontext.h> -#include <vespa/searchlib/query/tree/location.h> -#include <vespa/searchlib/query/tree/simplequery.h> #include <vespa/searchlib/queryeval/document_weight_search_iterator.h> #include <vespa/searchlib/test/searchiteratorverifier.h> #include <vespa/searchlib/util/randomgenerator.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/vespalib/test/insertion_operators.h> 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 b30b3e4eb71..7652e7e30a4 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 @@ -5,6 +5,7 @@ #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/log/log.h> diff --git a/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp b/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp index 9a4728edba8..44ae4f7385e 100644 --- a/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp +++ b/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp @@ -17,6 +17,7 @@ #include <vespa/searchlib/util/bufferwriter.h> #include <vespa/searchlib/util/file_settings.h> #include <vespa/searchlib/util/randomgenerator.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/data/databuffer.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/compress.h> diff --git a/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp b/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp index 167eaccc2f7..b9f3c23213e 100644 --- a/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp +++ b/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp @@ -429,7 +429,7 @@ struct MockAttributeVector : NotImplementedAttribute { long _return_value{1234}; MockAttributeVector() - : NotImplementedAttribute("mock", Config(BasicType::STRING)) { + : NotImplementedAttribute("mock") { } void set_received_args(DocId doc_id, void* ser_to, diff --git a/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp b/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp index 566001cbe17..735ebcff6cf 100644 --- a/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp +++ b/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp @@ -3,6 +3,7 @@ #include <vespa/searchlib/attribute/multi_value_mapping.h> #include <vespa/searchlib/attribute/multi_value_mapping.hpp> #include <vespa/searchlib/attribute/not_implemented_attribute.h> +#include <vespa/vespalib/datastore/compaction_strategy.h> #include <vespa/vespalib/gtest/gtest.h> #include <vespa/vespalib/stllike/hash_set.h> #include <vespa/vespalib/test/insertion_operators.h> @@ -49,7 +50,7 @@ class MyAttribute : public search::NotImplementedAttribute public: MyAttribute(MvMapping &mvMapping) - : NotImplementedAttribute("test", AttributeVector::Config()), + : NotImplementedAttribute("test"), _mvMapping(mvMapping) {} virtual bool addDoc(DocId &doc) override { diff --git a/searchlib/src/tests/attribute/multi_value_read_view/multi_value_read_view_test.cpp b/searchlib/src/tests/attribute/multi_value_read_view/multi_value_read_view_test.cpp index edebaa84ddb..2b47bf0a7c9 100644 --- a/searchlib/src/tests/attribute/multi_value_read_view/multi_value_read_view_test.cpp +++ b/searchlib/src/tests/attribute/multi_value_read_view/multi_value_read_view_test.cpp @@ -3,6 +3,7 @@ #include <vespa/document/base/documentid.h> #include <vespa/searchcommon/attribute/i_multi_value_attribute.h> #include <vespa/searchcommon/attribute/multi_value_traits.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/attribute_read_guard.h> #include <vespa/searchlib/attribute/extendableattributes.h> diff --git a/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp b/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp index 5cee31bf909..b5101f1ea58 100644 --- a/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp +++ b/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp @@ -11,10 +11,10 @@ #include <vespa/searchlib/queryeval/fake_result.h> #include <vespa/searchlib/queryeval/searchiterator.h> #include <vespa/searchlib/test/mock_gid_to_lid_mapping.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/gtest/gtest.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/test/insertion_operators.h> -#include <vespa/vespalib/util/traits.h> #include <vespa/log/log.h> LOG_SETUP("reference_attribute_test"); diff --git a/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp b/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp index 0bdd4f5b4dc..26fbed81146 100644 --- a/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp @@ -4,7 +4,6 @@ #include <vespa/searchlib/attribute/attribute_weighted_set_blueprint.h> #include <vespa/searchlib/attribute/attributecontext.h> #include <vespa/searchlib/attribute/attributevector.h> -#include <vespa/searchlib/attribute/attribute_read_guard.h> #include <vespa/searchlib/attribute/extendableattributes.h> #include <vespa/searchlib/attribute/singlestringattribute.h> #include <vespa/searchlib/attribute/attributefactory.h> @@ -15,6 +14,7 @@ #include <vespa/searchlib/queryeval/fake_requestcontext.h> #include <vespa/searchlib/test/mock_attribute_manager.h> #include <vespa/searchlib/attribute/enumstore.hpp> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/log/log.h> LOG_SETUP("attribute_weighted_set_blueprint_test"); diff --git a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp index 1c869716d1e..67bd0286884 100644 --- a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp @@ -1,9 +1,5 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/eval/eval/tensor_spec.h> -#include <vespa/eval/eval/value.h> -#include <vespa/eval/eval/value_codec.h> -#include <vespa/searchcommon/attribute/iattributecontext.h> #include <vespa/searchlib/attribute/attribute_blueprint_factory.h> #include <vespa/searchlib/attribute/attribute_read_guard.h> #include <vespa/searchlib/attribute/attributecontext.h> @@ -18,6 +14,11 @@ #include <vespa/searchlib/queryeval/leaf_blueprints.h> #include <vespa/searchlib/queryeval/nearest_neighbor_blueprint.h> #include <vespa/searchlib/tensor/dense_tensor_attribute.h> +#include <vespa/searchcommon/attribute/iattributecontext.h> +#include <vespa/searchcommon/attribute/config.h> +#include <vespa/eval/eval/tensor_spec.h> +#include <vespa/eval/eval/value.h> +#include <vespa/eval/eval/value_codec.h> #include <vespa/vespalib/gtest/gtest.h> #include <vespa/log/log.h> diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp index 947e4aa30c2..78d82459260 100644 --- a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp +++ b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp @@ -16,6 +16,7 @@ #include <vespa/searchlib/queryeval/hitcollector.h> #include <vespa/searchlib/queryeval/simpleresult.h> #include <vespa/searchlib/test/searchiteratorverifier.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/compress.h> #include <vespa/vespalib/util/stringfmt.h> diff --git a/searchlib/src/tests/attribute/searchcontextelementiterator/searchcontextelementiterator_test.cpp b/searchlib/src/tests/attribute/searchcontextelementiterator/searchcontextelementiterator_test.cpp index 14861819bb5..06ca299b9ba 100644 --- a/searchlib/src/tests/attribute/searchcontextelementiterator/searchcontextelementiterator_test.cpp +++ b/searchlib/src/tests/attribute/searchcontextelementiterator/searchcontextelementiterator_test.cpp @@ -7,7 +7,7 @@ #include <vespa/searchlib/queryeval/fake_search.h> #include <vespa/searchlib/query/query_term_simple.h> #include <vespa/searchlib/fef/termfieldmatchdata.h> -# +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/gtest/gtest.h> diff --git a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp index eb73edbde46..e8450104963 100644 --- a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp +++ b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp @@ -1,11 +1,5 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/document/base/exceptions.h> -#include <vespa/eval/eval/simple_value.h> -#include <vespa/eval/eval/tensor_spec.h> -#include <vespa/eval/eval/value.h> -#include <vespa/eval/eval/test/value_compare.h> -#include <vespa/fastos/file.h> #include <vespa/searchlib/attribute/attribute_read_guard.h> #include <vespa/searchlib/attribute/attributeguard.h> #include <vespa/searchlib/queryeval/nearest_neighbor_blueprint.h> @@ -23,6 +17,7 @@ #include <vespa/searchlib/tensor/tensor_attribute.h> #include <vespa/searchlib/test/directory_handler.h> #include <vespa/searchlib/util/fileutil.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/data/fileheader.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/test/insertion_operators.h> @@ -30,6 +25,12 @@ #include <vespa/vespalib/util/mmap_file_allocator_factory.h> #include <vespa/searchlib/util/bufferwriter.h> #include <vespa/vespalib/util/threadstackexecutor.h> +#include <vespa/document/base/exceptions.h> +#include <vespa/eval/eval/simple_value.h> +#include <vespa/eval/eval/tensor_spec.h> +#include <vespa/eval/eval/value.h> +#include <vespa/eval/eval/test/value_compare.h> +#include <vespa/fastos/file.h> #include <vespa/log/log.h> LOG_SETUP("tensorattribute_test"); diff --git a/searchlib/src/tests/common/location_iterator/location_iterator_test.cpp b/searchlib/src/tests/common/location_iterator/location_iterator_test.cpp index fff296f35ed..44a2f1697cd 100644 --- a/searchlib/src/tests/common/location_iterator/location_iterator_test.cpp +++ b/searchlib/src/tests/common/location_iterator/location_iterator_test.cpp @@ -3,11 +3,11 @@ #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/attributeguard.h> #include <vespa/searchlib/attribute/attributevector.h> -#include <vespa/searchlib/attribute/iattributemanager.h> #include <vespa/searchlib/attribute/integerbase.h> #include <vespa/searchlib/common/geo_location.h> #include <vespa/searchlib/common/location.h> #include <vespa/searchlib/common/locationiterators.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/gtest/gtest.h> #include <vespa/log/log.h> diff --git a/searchlib/src/tests/expression/attributenode/attribute_node_test.cpp b/searchlib/src/tests/expression/attributenode/attribute_node_test.cpp index afd2c2a2fac..059f198a070 100644 --- a/searchlib/src/tests/expression/attributenode/attribute_node_test.cpp +++ b/searchlib/src/tests/expression/attributenode/attribute_node_test.cpp @@ -1,6 +1,5 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/searchcommon/common/undefinedvalues.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/attributecontext.h> #include <vespa/searchlib/attribute/attributemanager.h> @@ -11,6 +10,8 @@ #include <vespa/searchlib/attribute/singleboolattribute.h> #include <vespa/searchlib/expression/attributenode.h> #include <vespa/searchlib/expression/resultvector.h> +#include <vespa/searchcommon/attribute/config.h> +#include <vespa/searchcommon/common/undefinedvalues.h> #include <vespa/searchlib/test/make_attribute_map_lookup_node.h> #include <vespa/vespalib/test/insertion_operators.h> #include <vespa/vespalib/testkit/testapp.h> diff --git a/searchlib/src/tests/features/euclidean_distance/euclidean_distance_test.cpp b/searchlib/src/tests/features/euclidean_distance/euclidean_distance_test.cpp index 51609ef7f67..eed59fdde5e 100644 --- a/searchlib/src/tests/features/euclidean_distance/euclidean_distance_test.cpp +++ b/searchlib/src/tests/features/euclidean_distance/euclidean_distance_test.cpp @@ -7,11 +7,11 @@ #include <vespa/searchlib/attribute/floatbase.h> #include <vespa/searchlib/features/setup.h> #include <vespa/searchlib/fef/test/indexenvironment.h> -#include <vespa/searchlib/fef/test/indexenvironmentbuilder.h> -#include <vespa/searchlib/fef/test/queryenvironment.h> #include <vespa/searchlib/fef/test/ftlib.h> #include <vespa/searchlib/features/euclidean_distance_feature.h> #include <vespa/searchlib/fef/fef.h> +#include <vespa/searchcommon/attribute/config.h> + using search::feature_t; using namespace search::fef; diff --git a/searchlib/src/tests/features/featurebenchmark.cpp b/searchlib/src/tests/features/featurebenchmark.cpp index 5a70f1752fc..a3188ce21fa 100644 --- a/searchlib/src/tests/features/featurebenchmark.cpp +++ b/searchlib/src/tests/features/featurebenchmark.cpp @@ -12,6 +12,7 @@ #include <vespa/searchlib/fef/test/plugin/setup.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/searchlib/fef/test/ftlib.h> +#include <vespa/searchcommon/attribute/config.h> #include <fstream> #include <iomanip> diff --git a/searchlib/src/tests/features/internal_max_reduce_prod_join_feature/internal_max_reduce_prod_join_feature_test.cpp b/searchlib/src/tests/features/internal_max_reduce_prod_join_feature/internal_max_reduce_prod_join_feature_test.cpp index fba88644dcb..532f646ae4d 100644 --- a/searchlib/src/tests/features/internal_max_reduce_prod_join_feature/internal_max_reduce_prod_join_feature_test.cpp +++ b/searchlib/src/tests/features/internal_max_reduce_prod_join_feature/internal_max_reduce_prod_join_feature_test.cpp @@ -6,6 +6,7 @@ #include <vespa/searchlib/fef/test/ftlib.h> #include <vespa/searchlib/features/internal_max_reduce_prod_join_feature.h> #include <vespa/searchlib/attribute/attribute.h> +#include <vespa/searchcommon/attribute/config.h> using search::feature_t; using namespace search::fef; diff --git a/searchlib/src/tests/features/prod_features.cpp b/searchlib/src/tests/features/prod_features.cpp index 002cfdc7f3b..2c04a326e3e 100644 --- a/searchlib/src/tests/features/prod_features.cpp +++ b/searchlib/src/tests/features/prod_features.cpp @@ -41,6 +41,7 @@ #include <vespa/searchlib/fef/queryproperties.h> #include <vespa/searchlib/fef/test/plugin/setup.h> #include <vespa/searchlib/fef/test/dummy_dependency_handler.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/util/rand48.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/geo/zcurve.h> diff --git a/searchlib/src/tests/features/prod_features_attributematch.cpp b/searchlib/src/tests/features/prod_features_attributematch.cpp index 1db6212abef..fd6fdca96fc 100644 --- a/searchlib/src/tests/features/prod_features_attributematch.cpp +++ b/searchlib/src/tests/features/prod_features_attributematch.cpp @@ -4,6 +4,7 @@ #include <vespa/searchlib/features/attributematchfeature.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/attributevector.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/log/log.h> LOG_SETUP(".prod_features_attributematch"); diff --git a/searchlib/src/tests/features/tensor/tensor_test.cpp b/searchlib/src/tests/features/tensor/tensor_test.cpp index a8c4d6714d8..54807273aea 100644 --- a/searchlib/src/tests/features/tensor/tensor_test.cpp +++ b/searchlib/src/tests/features/tensor/tensor_test.cpp @@ -7,10 +7,9 @@ #include <vespa/searchlib/fef/fef.h> #include <vespa/searchlib/fef/test/ftlib.h> #include <vespa/searchlib/fef/test/indexenvironment.h> -#include <vespa/searchlib/fef/test/indexenvironmentbuilder.h> -#include <vespa/searchlib/fef/test/queryenvironment.h> #include <vespa/searchlib/tensor/tensor_attribute.h> #include <vespa/searchlib/tensor/direct_tensor_attribute.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/eval/eval/function.h> #include <vespa/eval/eval/simple_value.h> #include <vespa/eval/eval/tensor_spec.h> diff --git a/searchlib/src/tests/features/tensor_from_labels/tensor_from_labels_test.cpp b/searchlib/src/tests/features/tensor_from_labels/tensor_from_labels_test.cpp index 8ac73253625..b2143bacfd9 100644 --- a/searchlib/src/tests/features/tensor_from_labels/tensor_from_labels_test.cpp +++ b/searchlib/src/tests/features/tensor_from_labels/tensor_from_labels_test.cpp @@ -10,8 +10,7 @@ #include <vespa/searchlib/fef/fef.h> #include <vespa/searchlib/fef/test/ftlib.h> #include <vespa/searchlib/fef/test/indexenvironment.h> -#include <vespa/searchlib/fef/test/indexenvironmentbuilder.h> -#include <vespa/searchlib/fef/test/queryenvironment.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/eval/eval/function.h> #include <vespa/eval/eval/simple_value.h> #include <vespa/eval/eval/tensor_spec.h> diff --git a/searchlib/src/tests/features/tensor_from_weighted_set/tensor_from_weighted_set_test.cpp b/searchlib/src/tests/features/tensor_from_weighted_set/tensor_from_weighted_set_test.cpp index 4d213434073..e832812a2e1 100644 --- a/searchlib/src/tests/features/tensor_from_weighted_set/tensor_from_weighted_set_test.cpp +++ b/searchlib/src/tests/features/tensor_from_weighted_set/tensor_from_weighted_set_test.cpp @@ -10,8 +10,7 @@ #include <vespa/searchlib/fef/fef.h> #include <vespa/searchlib/fef/test/ftlib.h> #include <vespa/searchlib/fef/test/indexenvironment.h> -#include <vespa/searchlib/fef/test/indexenvironmentbuilder.h> -#include <vespa/searchlib/fef/test/queryenvironment.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/eval/eval/function.h> #include <vespa/eval/eval/simple_value.h> #include <vespa/eval/eval/tensor_spec.h> diff --git a/searchlib/src/tests/fef/attributecontent/attributecontent_test.cpp b/searchlib/src/tests/fef/attributecontent/attributecontent_test.cpp index f62bfa87d45..08ae2701eb9 100644 --- a/searchlib/src/tests/fef/attributecontent/attributecontent_test.cpp +++ b/searchlib/src/tests/fef/attributecontent/attributecontent_test.cpp @@ -1,10 +1,12 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP("attributecontent_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/searchcommon/attribute/attributecontent.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/integerbase.h> +#include <vespa/log/log.h> +LOG_SETUP("attributecontent_test"); using namespace search::attribute; diff --git a/searchlib/src/tests/queryeval/matching_elements_search/matching_elements_search_test.cpp b/searchlib/src/tests/queryeval/matching_elements_search/matching_elements_search_test.cpp index 3bb59480ed9..561691cc5c8 100644 --- a/searchlib/src/tests/queryeval/matching_elements_search/matching_elements_search_test.cpp +++ b/searchlib/src/tests/queryeval/matching_elements_search/matching_elements_search_test.cpp @@ -8,6 +8,7 @@ #include <vespa/searchlib/attribute/i_document_weight_attribute.h> #include <vespa/searchlib/common/matching_elements.h> #include <vespa/searchlib/queryeval/matching_elements_search.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/gtest/gtest.h> using search::attribute::BasicType; diff --git a/searchlib/src/tests/queryeval/nearest_neighbor/nearest_neighbor_test.cpp b/searchlib/src/tests/queryeval/nearest_neighbor/nearest_neighbor_test.cpp index d34ae0dfda6..029b74ff914 100644 --- a/searchlib/src/tests/queryeval/nearest_neighbor/nearest_neighbor_test.cpp +++ b/searchlib/src/tests/queryeval/nearest_neighbor/nearest_neighbor_test.cpp @@ -14,6 +14,7 @@ #include <vespa/searchlib/tensor/distance_function_factory.h> #include <vespa/vespalib/test/insertion_operators.h> #include <vespa/searchlib/queryeval/nns_index_iterator.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/log/log.h> LOG_SETUP("nearest_neighbor_test"); diff --git a/searchlib/src/tests/queryeval/predicate/predicate_blueprint_test.cpp b/searchlib/src/tests/queryeval/predicate/predicate_blueprint_test.cpp index 44731bac7f6..56e745afa50 100644 --- a/searchlib/src/tests/queryeval/predicate/predicate_blueprint_test.cpp +++ b/searchlib/src/tests/queryeval/predicate/predicate_blueprint_test.cpp @@ -1,7 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. // Unit tests for predicate_blueprint. -#include <vespa/searchlib/attribute/attributeguard.h> #include <vespa/searchlib/attribute/predicate_attribute.h> #include <vespa/searchlib/predicate/predicate_tree_annotator.h> #include <vespa/searchlib/predicate/predicate_index.h> @@ -33,14 +32,13 @@ namespace { struct Fixture { FieldSpecBase field; AttributeVector::SP attribute; - vespalib::GenerationHandler generation_handler; SimplePredicateQuery query; using IntervalRange = PredicateAttribute::IntervalRange; Fixture() : field(42, 0), - attribute(std::make_shared<PredicateAttribute>("f", attribute::Config(attribute::BasicType::PREDICATE))), + attribute(std::make_shared<PredicateAttribute>("f")), query(std::make_unique<PredicateQueryTerm>(),"view", 0, Weight(1)) { query.getTerm()->addFeature("key", "value"); diff --git a/searchlib/src/tests/queryeval/queryeval.cpp b/searchlib/src/tests/queryeval/queryeval.cpp index dbf8ddba52c..2f03525644a 100644 --- a/searchlib/src/tests/queryeval/queryeval.cpp +++ b/searchlib/src/tests/queryeval/queryeval.cpp @@ -18,6 +18,7 @@ #include <vespa/searchlib/queryeval/isourceselector.h> #include <vespa/searchlib/query/query_term_simple.h> #include <vespa/searchlib/attribute/singleboolattribute.h> +#include <vespa/searchcommon/common/growstrategy.h> #include <vespa/vespalib/test/insertion_operators.h> #include <vespa/searchlib/fef/fef.h> #include <vespa/vespalib/data/slime/slime.h> diff --git a/searchlib/src/tests/ranksetup/ranksetup_test.cpp b/searchlib/src/tests/ranksetup/ranksetup_test.cpp index ddd3f946cc5..63209446746 100644 --- a/searchlib/src/tests/ranksetup/ranksetup_test.cpp +++ b/searchlib/src/tests/ranksetup/ranksetup_test.cpp @@ -8,6 +8,7 @@ #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/attributevector.h> #include <vespa/searchlib/attribute/integerbase.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/searchlib/fef/blueprint.h> #include <vespa/searchlib/fef/blueprintfactory.h> diff --git a/searchlib/src/tests/sortspec/multilevelsort.cpp b/searchlib/src/tests/sortspec/multilevelsort.cpp index 9c1caaff662..18c1ef9a615 100644 --- a/searchlib/src/tests/sortspec/multilevelsort.cpp +++ b/searchlib/src/tests/sortspec/multilevelsort.cpp @@ -7,6 +7,7 @@ #include <vespa/searchlib/attribute/attributecontext.h> #include <vespa/searchlib/attribute/attributemanager.h> #include <vespa/searchlib/uca/ucaconverter.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/util/testclock.h> #include <vespa/vespalib/testkit/testapp.h> #include <type_traits> diff --git a/searchlib/src/vespa/searchlib/attribute/attributefactory.cpp b/searchlib/src/vespa/searchlib/attribute/attributefactory.cpp index 4f846e8d68a..0f9c01b357f 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributefactory.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributefactory.cpp @@ -2,6 +2,7 @@ #include "attributefactory.h" #include "attributevector.h" +#include <vespa/searchcommon/attribute/config.h> #include <vespa/log/log.h> LOG_SETUP(".searchlib.attributefactory"); diff --git a/searchlib/src/vespa/searchlib/attribute/attributefactory.h b/searchlib/src/vespa/searchlib/attribute/attributefactory.h index fcdef25a963..73b8e2b0eb6 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributefactory.h +++ b/searchlib/src/vespa/searchlib/attribute/attributefactory.h @@ -2,9 +2,10 @@ #pragma once -#include <vespa/searchcommon/attribute/config.h> +#include <vespa/vespalib/stllike/string.h> #include <memory> +namespace search::attribute { class Config; } namespace search { class AttributeVector; diff --git a/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp b/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp index 4b87435dd2e..d218f11d198 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp @@ -6,6 +6,7 @@ #include "attributemanager.h" #include "attrvector.h" #include "interlock.h" +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/stllike/hash_map.hpp> #include <vespa/vespalib/util/exceptions.h> #include <condition_variable> diff --git a/searchlib/src/vespa/searchlib/attribute/attributemanager.h b/searchlib/src/vespa/searchlib/attribute/attributemanager.h index daa6c725908..28e50490a17 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributemanager.h +++ b/searchlib/src/vespa/searchlib/attribute/attributemanager.h @@ -5,10 +5,11 @@ #include "iattributemanager.h" #include "interlock.h" #include <vespa/searchlib/common/indexmetainfo.h> -#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/stllike/hash_map.h> #include <mutex> +namespace search::attribute { class Config; } + namespace search { /** @@ -18,7 +19,7 @@ namespace search { class AttributeManager : public IAttributeManager { private: - typedef attribute::Config Config; + using Config = attribute::Config; public: typedef std::vector<string> StringVector; typedef search::IndexMetaInfo::Snapshot Snapshot; diff --git a/searchlib/src/vespa/searchlib/attribute/configconverter.cpp b/searchlib/src/vespa/searchlib/attribute/configconverter.cpp index f6e8266f858..9aac4f301d5 100644 --- a/searchlib/src/vespa/searchlib/attribute/configconverter.cpp +++ b/searchlib/src/vespa/searchlib/attribute/configconverter.cpp @@ -1,6 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "configconverter.h" +#include <vespa/searchcommon/attribute/config.h> using namespace vespa::config::search; diff --git a/searchlib/src/vespa/searchlib/attribute/createarrayfastsearch.cpp b/searchlib/src/vespa/searchlib/attribute/createarrayfastsearch.cpp index 9de2a1750e1..5e22352c1d4 100644 --- a/searchlib/src/vespa/searchlib/attribute/createarrayfastsearch.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createarrayfastsearch.cpp @@ -5,6 +5,7 @@ #include "floatbase.h" #include "flagattribute.h" #include "defines.h" +#include <vespa/searchcommon/attribute/config.h> #include <vespa/log/log.h> LOG_SETUP(".createarrayfastsearch"); @@ -39,7 +40,7 @@ AttributeFactory::createArrayFastSearch(stringref name, const Config & info) case BasicType::UINT4: break; case BasicType::INT8: - ret.reset(static_cast<AttributeVector *>(new FlagAttribute(name, info))); + ret = std::make_shared<FlagAttribute>(name, info); break; case BasicType::INT16: ret.reset(CREATEINTARRAY(int16_t, name, info)); @@ -57,7 +58,7 @@ AttributeFactory::createArrayFastSearch(stringref name, const Config & info) ret.reset(CREATEFLOATARRAY(double, name, info)); break; case BasicType::STRING: - ret.reset(static_cast<AttributeVector *>(new ArrayStringPostingAttribute(name, info))); + ret = std::make_shared<ArrayStringPostingAttribute>(name, info); break; default: break; diff --git a/searchlib/src/vespa/searchlib/attribute/createsinglefastsearch.cpp b/searchlib/src/vespa/searchlib/attribute/createsinglefastsearch.cpp index 66e6e7ccd4d..05b6bb07a19 100644 --- a/searchlib/src/vespa/searchlib/attribute/createsinglefastsearch.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createsinglefastsearch.cpp @@ -6,6 +6,7 @@ #include "defines.h" #include "singlestringattribute.h" #include "singleboolattribute.h" +#include <vespa/searchcommon/attribute/config.h> #include "singlestringpostattribute.hpp" #include "singlenumericpostattribute.hpp" #include <vespa/searchlib/tensor/direct_tensor_attribute.h> diff --git a/searchlib/src/vespa/searchlib/attribute/enumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/enumattribute.hpp index 24dfe742120..86f0803aa3e 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/enumattribute.hpp @@ -6,6 +6,7 @@ #include <vespa/vespalib/util/hdr_abort.h> #include <vespa/searchlib/attribute/enumattribute.h> #include <vespa/searchlib/attribute/enumstore.hpp> +#include <vespa/searchcommon/attribute/config.h> namespace search { diff --git a/searchlib/src/vespa/searchlib/attribute/extendableattributes.cpp b/searchlib/src/vespa/searchlib/attribute/extendableattributes.cpp index 941450fccb5..30b509562e2 100644 --- a/searchlib/src/vespa/searchlib/attribute/extendableattributes.cpp +++ b/searchlib/src/vespa/searchlib/attribute/extendableattributes.cpp @@ -1,12 +1,12 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include "extendableattributes.h" -#include "attrvector.hpp" +#include "extendableattributes.hpp" #include "extendable_numeric_array_multi_value_read_view.h" #include "extendable_numeric_weighted_set_multi_value_read_view.h" #include "extendable_string_array_multi_value_read_view.h" #include "extendable_string_weighted_set_multi_value_read_view.h" #include <vespa/vespalib/util/stash.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/log/log.h> LOG_SETUP(".searchlib.attribute.extendable_attributes"); @@ -129,7 +129,15 @@ WeightedSetIntegerExtAttribute::WeightedSetIntegerExtAttribute(const vespalib::s { } -WeightedSetIntegerExtAttribute::~WeightedSetIntegerExtAttribute() {} +WeightedSetIntegerExtAttribute::~WeightedSetIntegerExtAttribute() = default; + +std::unique_ptr<attribute::SearchContext> +WeightedSetIntegerExtAttribute::getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const +{ + (void) term; + (void) params; + return {}; +} bool WeightedSetIntegerExtAttribute::add(int64_t v, int32_t w) @@ -161,7 +169,15 @@ WeightedSetFloatExtAttribute::WeightedSetFloatExtAttribute(const vespalib::strin { } -WeightedSetFloatExtAttribute::~WeightedSetFloatExtAttribute() {} +WeightedSetFloatExtAttribute::~WeightedSetFloatExtAttribute() = default; + +std::unique_ptr<attribute::SearchContext> +WeightedSetFloatExtAttribute::getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const +{ + (void) term; + (void) params; + return {}; +} bool WeightedSetFloatExtAttribute::add(double v, int32_t w) @@ -228,4 +244,10 @@ template class MultiExtAttribute<int32_t>; template class MultiExtAttribute<int64_t>; template class MultiExtAttribute<double>; +template class SingleExtAttribute<int8_t>; +template class SingleExtAttribute<int16_t>; +template class SingleExtAttribute<int32_t>; +template class SingleExtAttribute<int64_t>; +template class SingleExtAttribute<double>; + } diff --git a/searchlib/src/vespa/searchlib/attribute/extendableattributes.h b/searchlib/src/vespa/searchlib/attribute/extendableattributes.h index 86e6be8eff7..a3a0de5bfc5 100644 --- a/searchlib/src/vespa/searchlib/attribute/extendableattributes.h +++ b/searchlib/src/vespa/searchlib/attribute/extendableattributes.h @@ -7,7 +7,6 @@ #pragma once #include "attrvector.h" -#include "attrvector.hpp" #include <vespa/searchcommon/attribute/i_multi_value_attribute.h> namespace search { @@ -41,44 +40,25 @@ class SingleExtAttribute using QueryTermSimpleUP = typename Super::QueryTermSimpleUP; std::unique_ptr<attribute::SearchContext> - getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override - { - (void) term; - (void) params; - return {}; - } + getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override; IExtendAttribute * getExtendInterface() override { return this; } public: - SingleExtAttribute(const vespalib::string &name) - : Super(name, Config(BasicType::fromType(T()), - attribute::CollectionType::SINGLE)) {} + SingleExtAttribute(const vespalib::string &name); - bool addDoc(typename Super::DocId &docId) override { - docId = this->_data.size(); - this->_data.push_back(attribute::getUndefined<T>()); - this->incNumDocs(); - this->setCommittedDocIdLimit(this->getNumDocs()); - return true; - } - bool add(typename AddValueType<T>::Type v, int32_t = 1) override { - this->_data.back() = v; - return true; - } + bool addDoc(typename Super::DocId &docId) override; + bool add(typename AddValueType<T>::Type v, int32_t = 1) override; bool onLoad(vespalib::Executor *) override { return false; // Emulate that this attribute is never loaded } - void onAddDocs(typename Super::DocId lidLimit) override { - this->_data.reserve(lidLimit); - } + void onAddDocs(typename Super::DocId lidLimit) override; }; -typedef SingleExtAttribute<int8_t> SingleInt8ExtAttribute; -typedef SingleExtAttribute<int16_t> SingleInt16ExtAttribute; -typedef SingleExtAttribute<int32_t> SingleInt32ExtAttribute; -typedef SingleExtAttribute<int64_t> SingleInt64ExtAttribute; -typedef SingleExtAttribute<double> SingleFloatExtAttribute; - -typedef SingleInt64ExtAttribute SingleIntegerExtAttribute; +using SingleInt8ExtAttribute = SingleExtAttribute<int8_t>; +using SingleInt16ExtAttribute = SingleExtAttribute<int16_t>; +using SingleInt32ExtAttribute = SingleExtAttribute<int32_t>; +using SingleInt64ExtAttribute = SingleExtAttribute<int64_t>; +using SingleFloatExtAttribute = SingleExtAttribute<double>; +using SingleIntegerExtAttribute = SingleInt64ExtAttribute; class SingleStringExtAttribute : public StringDirectAttrVector< AttrVector::Features<false> >, @@ -109,45 +89,22 @@ protected: typedef typename Super::BasicType BasicType; using QueryTermSimpleUP = AttributeVector::QueryTermSimpleUP; - MultiExtAttribute(const vespalib::string &name, const attribute::CollectionType &ctype) - : Super(name, Config(BasicType::fromType(T()), ctype)) - { } + MultiExtAttribute(const vespalib::string &name, const attribute::CollectionType &ctype); private: std::unique_ptr<attribute::SearchContext> - getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override - { - (void) term; - (void) params; - return {}; - } + getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override; IExtendAttribute * getExtendInterface() override { return this; } public: - MultiExtAttribute(const vespalib::string &name) - : Super(name, Config(BasicType::fromType(static_cast<T>(0)), - attribute::CollectionType::ARRAY)) {} + MultiExtAttribute(const vespalib::string &name); ~MultiExtAttribute() override; - bool addDoc(typename Super::DocId &docId) override { - docId = this->_idx.size() - 1; - this->_idx.push_back(this->_idx.back()); - this->incNumDocs(); - this->setCommittedDocIdLimit(this->getNumDocs()); - return true; - } - bool add(typename AddValueType<T>::Type v, int32_t = 1) override { - this->_data.push_back(v); - std::vector<uint32_t> &idx = this->_idx; - idx.back()++; - this->checkSetMaxValueCount(idx.back() - idx[idx.size() - 2]); - return true; - } + bool addDoc(typename Super::DocId &docId) override; + bool add(typename AddValueType<T>::Type v, int32_t = 1) override; bool onLoad(vespalib::Executor *) override { return false; // Emulate that this attribute is never loaded } - void onAddDocs(uint32_t lidLimit) override { - this->_data.reserve(lidLimit); - } + void onAddDocs(uint32_t lidLimit) override; const attribute::IMultiValueAttribute* as_multi_value_attribute() const override; // Implements attribute::IMultiValueAttribute @@ -155,16 +112,12 @@ public: const attribute::IWeightedSetReadView<T>* make_read_view(attribute::IMultiValueAttribute::WeightedSetTag<T>, vespalib::Stash& stash) const override; }; -template <typename T> -MultiExtAttribute<T>::~MultiExtAttribute() = default; - -typedef MultiExtAttribute<int8_t> MultiInt8ExtAttribute; -typedef MultiExtAttribute<int16_t> MultiInt16ExtAttribute; -typedef MultiExtAttribute<int32_t> MultiInt32ExtAttribute; -typedef MultiExtAttribute<int64_t> MultiInt64ExtAttribute; -typedef MultiExtAttribute<double> MultiFloatExtAttribute; - -typedef MultiInt64ExtAttribute MultiIntegerExtAttribute; +using MultiInt8ExtAttribute = MultiExtAttribute<int8_t>; +using MultiInt16ExtAttribute = MultiExtAttribute<int16_t>; +using MultiInt32ExtAttribute = MultiExtAttribute<int32_t>; +using MultiInt64ExtAttribute = MultiExtAttribute<int64_t>; +using MultiFloatExtAttribute = MultiExtAttribute<double>; +using MultiIntegerExtAttribute = MultiInt64ExtAttribute; class MultiStringExtAttribute : public StringDirectAttrVector< AttrVector::Features<true> >, @@ -199,17 +152,12 @@ private: std::vector<int32_t> _weights; protected: - void addWeight(int32_t w) { - _weights.push_back(w); - } + void addWeight(int32_t w); int32_t getWeightHelper(AttributeVector::DocId docId, uint32_t idx) const { return _weights[this->_idx[docId] + idx]; } - WeightedSetExtAttributeBase(const vespalib::string & name) : - B(name, attribute::CollectionType::WSET), - _weights() - {} - ~WeightedSetExtAttributeBase() {} + WeightedSetExtAttributeBase(const vespalib::string & name); + ~WeightedSetExtAttributeBase(); const std::vector<int32_t>& get_weights() const noexcept { return _weights; } }; @@ -217,12 +165,7 @@ class WeightedSetIntegerExtAttribute : public WeightedSetExtAttributeBase<MultiIntegerExtAttribute> { std::unique_ptr<attribute::SearchContext> - getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override - { - (void) term; - (void) params; - return {}; - } + getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override; public: WeightedSetIntegerExtAttribute(const vespalib::string & name); ~WeightedSetIntegerExtAttribute(); @@ -236,12 +179,7 @@ class WeightedSetFloatExtAttribute : public WeightedSetExtAttributeBase<MultiFloatExtAttribute> { std::unique_ptr<attribute::SearchContext> - getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override - { - (void) term; - (void) params; - return {}; - } + getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override; public: WeightedSetFloatExtAttribute(const vespalib::string & name); ~WeightedSetFloatExtAttribute(); diff --git a/searchlib/src/vespa/searchlib/attribute/extendableattributes.hpp b/searchlib/src/vespa/searchlib/attribute/extendableattributes.hpp new file mode 100644 index 00000000000..c515a1bec7f --- /dev/null +++ b/searchlib/src/vespa/searchlib/attribute/extendableattributes.hpp @@ -0,0 +1,110 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +/** + * @class search::SearchVisitor + * + * @brief Visitor that applies a search query to visitor data and converts them to a SearchResultCommand + */ +#pragma once + +#include "extendableattributes.h" +#include "attrvector.hpp" + +namespace search { + +template <typename T> +std::unique_ptr<attribute::SearchContext> +SingleExtAttribute<T>::getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const +{ + (void) term; + (void) params; + return {}; +} + +template <typename T> +SingleExtAttribute<T>::SingleExtAttribute(const vespalib::string &name) + : Super(name, Config(BasicType::fromType(T()), attribute::CollectionType::SINGLE)) +{} + +template <typename T> +bool +SingleExtAttribute<T>::addDoc(typename Super::DocId &docId) { + docId = this->_data.size(); + this->_data.push_back(attribute::getUndefined<T>()); + this->incNumDocs(); + this->setCommittedDocIdLimit(this->getNumDocs()); + return true; +} +template <typename T> +bool +SingleExtAttribute<T>::add(typename AddValueType<T>::Type v, int32_t ) { + this->_data.back() = v; + return true; +} +template <typename T> +void +SingleExtAttribute<T>::onAddDocs(typename Super::DocId lidLimit) { + this->_data.reserve(lidLimit); +} + +template <typename T> +MultiExtAttribute<T>::MultiExtAttribute(const vespalib::string &name, const attribute::CollectionType &ctype) + : Super(name, Config(BasicType::fromType(T()), ctype)) +{ } +template <typename T> +std::unique_ptr<attribute::SearchContext> +MultiExtAttribute<T>::getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const +{ + (void) term; + (void) params; + return {}; +} + +template <typename T> +MultiExtAttribute<T>::MultiExtAttribute(const vespalib::string &name) + : Super(name, Config(BasicType::fromType(static_cast<T>(0)), attribute::CollectionType::ARRAY)) +{} + +template <typename T> +bool +MultiExtAttribute<T>::addDoc(typename Super::DocId &docId) { + docId = this->_idx.size() - 1; + this->_idx.push_back(this->_idx.back()); + this->incNumDocs(); + this->setCommittedDocIdLimit(this->getNumDocs()); + return true; +} +template <typename T> +bool +MultiExtAttribute<T>::add(typename AddValueType<T>::Type v, int32_t) { + this->_data.push_back(v); + std::vector<uint32_t> &idx = this->_idx; + idx.back()++; + this->checkSetMaxValueCount(idx.back() - idx[idx.size() - 2]); + return true; +} +template <typename T> +void +MultiExtAttribute<T>::onAddDocs(uint32_t lidLimit) { + this->_data.reserve(lidLimit); +} + +template <typename T> +MultiExtAttribute<T>::~MultiExtAttribute() = default; + +template <typename B> +WeightedSetExtAttributeBase<B>::WeightedSetExtAttributeBase(const vespalib::string & name) + : B(name, attribute::CollectionType::WSET), + _weights() +{} + +template <typename B> +WeightedSetExtAttributeBase<B>::~WeightedSetExtAttributeBase() = default; + +template <typename B> +void +WeightedSetExtAttributeBase<B>::addWeight(int32_t w) { + _weights.push_back(w); +} + +} // namespace search + diff --git a/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.cpp b/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.cpp index 22200633229..a2e14ea429d 100644 --- a/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.cpp @@ -1,6 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "fixedsourceselector.h" +#include <vespa/searchcommon/attribute/config.h> #include <vespa/log/log.h> LOG_SETUP(".searchlib.attribute.fixed_source_selector"); @@ -8,7 +9,8 @@ LOG_SETUP(".searchlib.attribute.fixed_source_selector"); namespace search { namespace { - attribute::Config getConfig() { return attribute::Config(attribute::BasicType::INT8); } + +attribute::Config getConfig() { return attribute::Config(attribute::BasicType::INT8); } uint32_t capSelector(queryeval::sourceselector::Iterator::SourceStore &store, queryeval::Source defaultSource) diff --git a/searchlib/src/vespa/searchlib/attribute/floatbase.hpp b/searchlib/src/vespa/searchlib/attribute/floatbase.hpp index 7b235b43124..2eaf501cce8 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/searchcommon/attribute/config.h> namespace search { diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.hpp b/searchlib/src/vespa/searchlib/attribute/integerbase.hpp index 94ffe17af4c..e25b92d1308 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/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 0602d983513..0d479855c4f 100644 --- a/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp @@ -2,6 +2,7 @@ #include "not_implemented_attribute.h" #include "search_context.h" +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/util/exceptions.h> using vespalib::make_string_short::fmt; @@ -10,6 +11,14 @@ namespace search { using largeint_t = attribute::IAttributeVector::largeint_t; using attribute::SearchContext; +NotImplementedAttribute::NotImplementedAttribute(const vespalib::string &name) + : NotImplementedAttribute(name, Config()) +{} + +NotImplementedAttribute::NotImplementedAttribute(const vespalib::string &name, const Config & cfg) + : AttributeVector(name, cfg) +{} + void NotImplementedAttribute::notImplemented() const { throw vespalib::UnsupportedOperationException(fmt("The function is not implemented for attribute '%s' of type '%s'.", diff --git a/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.h b/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.h index 8987681d640..9f951f6a41d 100644 --- a/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.h +++ b/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.h @@ -7,8 +7,8 @@ namespace search { struct NotImplementedAttribute : AttributeVector { - using AttributeVector::AttributeVector; - + NotImplementedAttribute(const vespalib::string & name); + NotImplementedAttribute(const vespalib::string & name, const Config & config); void notImplemented [[noreturn]] () const; uint32_t getValueCount(DocId) const override; diff --git a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp index 6268a6da701..56484813828 100644 --- a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp @@ -8,6 +8,7 @@ #include <vespa/document/predicate/predicate.h> #include <vespa/searchlib/predicate/predicate_index.h> #include <vespa/searchlib/util/fileutil.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/data/slime/slime.h> #include <vespa/vespalib/util/size_literals.h> @@ -69,6 +70,10 @@ SimpleIndexConfig createSimpleIndexConfig(const search::attribute::Config &confi } // namespace +PredicateAttribute::PredicateAttribute(const vespalib::string &base_file_name) + : PredicateAttribute(base_file_name, Config(BasicType::PREDICATE)) +{} + PredicateAttribute::PredicateAttribute(const vespalib::string &base_file_name, const Config &config) : NotImplementedAttribute(base_file_name, config), _limit_provider(*this), diff --git a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.h b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.h index 40823faff8a..0474513d5f4 100644 --- a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.h +++ b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.h @@ -40,6 +40,7 @@ public: DECLARE_IDENTIFIABLE_ABSTRACT(PredicateAttribute); + PredicateAttribute(const vespalib::string &base_file_name); PredicateAttribute(const vespalib::string &base_file_name, const Config &config); ~PredicateAttribute() override; diff --git a/searchlib/src/vespa/searchlib/attribute/search_context.cpp b/searchlib/src/vespa/searchlib/attribute/search_context.cpp index 8e8cca13671..3deacca5764 100644 --- a/searchlib/src/vespa/searchlib/attribute/search_context.cpp +++ b/searchlib/src/vespa/searchlib/attribute/search_context.cpp @@ -74,7 +74,7 @@ SearchContext::attributeName() const bool SearchContext::getIsFilter() const { - return _attr.getConfig().getIsFilter(); + return _attr.getIsFilter(); } diff --git a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.h b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.h index 3465269de8a..7868c228e77 100644 --- a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.h @@ -8,6 +8,8 @@ namespace search { +class GrowStrategy; + /** * Attributevector for boolean field values occupying a bit per document * and backed by a growable rcu bit vector. @@ -15,7 +17,7 @@ namespace search { class SingleBoolAttribute final : public IntegerAttributeTemplate<int8_t> { public: - SingleBoolAttribute(const vespalib::string & baseFileName, const search::GrowStrategy & grow, bool paged); + SingleBoolAttribute(const vespalib::string & baseFileName, const GrowStrategy & grow, bool paged); ~SingleBoolAttribute() override; void onCommit() override; diff --git a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h index 646edc786a3..4bf120d7952 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h @@ -10,6 +10,8 @@ namespace search { +class GrowStrategy; + class SingleValueSmallNumericAttribute : public IntegerAttributeTemplate<int8_t> { private: @@ -32,7 +34,7 @@ private: uint32_t _valueShiftMask; // 0x1f, 0x0f or 0x07 uint32_t _wordShift; // 0x05, 0x04 or 0x03 - typedef vespalib::RcuVectorBase<Word> DataVector; + using DataVector = vespalib::RcuVectorBase<Word>; DataVector _wordData; T getFromEnum(EnumHandle) const override { @@ -143,13 +145,13 @@ public: class SingleValueSemiNibbleNumericAttribute : public SingleValueSmallNumericAttribute { public: - SingleValueSemiNibbleNumericAttribute(const vespalib::string & baseFileName, const search::GrowStrategy & grow); + SingleValueSemiNibbleNumericAttribute(const vespalib::string & baseFileName, const GrowStrategy & grow); }; class SingleValueNibbleNumericAttribute : public SingleValueSmallNumericAttribute { public: - SingleValueNibbleNumericAttribute(const vespalib::string & baseFileName, const search::GrowStrategy & grow); + SingleValueNibbleNumericAttribute(const vespalib::string & baseFileName, const GrowStrategy & grow); }; } diff --git a/searchlib/src/vespa/searchlib/attribute/stringbase.cpp b/searchlib/src/vespa/searchlib/attribute/stringbase.cpp index b60ec269383..973f468a23e 100644 --- a/searchlib/src/vespa/searchlib/attribute/stringbase.cpp +++ b/searchlib/src/vespa/searchlib/attribute/stringbase.cpp @@ -8,6 +8,7 @@ #include <vespa/searchlib/common/sort.h> #include <vespa/document/fieldvalue/fieldvalue.h> #include <vespa/searchlib/query/query_term_ucs4.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/locale/c.h> #include <vespa/vespalib/util/array.hpp> @@ -285,6 +286,11 @@ StringAttribute::getChangeVectorMemoryUsage() const return _changes.getMemoryUsage(); } +bool +StringAttribute::get_match_is_cased() const noexcept { + return getConfig().get_match() == attribute::Config::Match::CASED; +} + template bool AttributeVector::clearDoc(StringAttribute::ChangeVector& changes, DocId doc); template bool AttributeVector::update(StringAttribute::ChangeVector& changes, DocId doc, const StringChangeData& v); template bool AttributeVector::append(StringAttribute::ChangeVector& changes, DocId doc, const StringChangeData& v, int32_t w, bool doCount); diff --git a/searchlib/src/vespa/searchlib/attribute/stringbase.h b/searchlib/src/vespa/searchlib/attribute/stringbase.h index e5e14829118..d282b3b0e33 100644 --- a/searchlib/src/vespa/searchlib/attribute/stringbase.h +++ b/searchlib/src/vespa/searchlib/attribute/stringbase.h @@ -73,7 +73,7 @@ protected: vespalib::MemoryUsage getChangeVectorMemoryUsage() const override; - bool get_match_is_cased() const noexcept { return getConfig().get_match() == attribute::Config::Match::CASED; } + bool get_match_is_cased() const noexcept; private: virtual void load_posting_lists(LoadedVector& loaded); virtual void load_enum_store(LoadedVector& loaded); diff --git a/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp index a3b197ac499..2fdb73fcf96 100644 --- a/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp +++ b/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp @@ -10,6 +10,7 @@ #include <vespa/fastlib/io/bufferedfile.h> #include <vespa/searchlib/attribute/load_utils.h> #include <vespa/searchlib/attribute/readerbase.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/data/slime/inserter.h> #include <vespa/vespalib/util/cpu_usage.h> #include <vespa/vespalib/util/lambdatask.h> diff --git a/searchlib/src/vespa/searchlib/tensor/serialized_fast_value_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/serialized_fast_value_attribute.cpp index 295a8aeaefc..2233eb77e89 100644 --- a/searchlib/src/vespa/searchlib/tensor/serialized_fast_value_attribute.cpp +++ b/searchlib/src/vespa/searchlib/tensor/serialized_fast_value_attribute.cpp @@ -4,6 +4,8 @@ #include "streamed_value_saver.h" #include <vespa/eval/eval/value.h> #include <vespa/fastlib/io/bufferedfile.h> +#include <vespa/searchcommon/attribute/config.h> + #include <vespa/log/log.h> LOG_SETUP(".searchlib.tensor.serialized_fast_value_attribute"); diff --git a/searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.cpp b/searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.cpp index 68cb3140eab..16296fe5a99 100644 --- a/searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.cpp +++ b/searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.cpp @@ -1,8 +1,17 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + #include "document_weight_attribute_helper.h" +#include <vespa/searchcommon/attribute/config.h> + +namespace search::test { + +AttributeVector::SP +DocumentWeightAttributeHelper::make_attr() { + attribute::Config cfg(attribute::BasicType::INT64, attribute::CollectionType::WSET); + cfg.setFastSearch(true); + return AttributeFactory::createAttribute("my_attribute", cfg); +} -namespace search { -namespace test { +DocumentWeightAttributeHelper::~DocumentWeightAttributeHelper() = default; -} // namespace search::test -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.h b/searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.h index 3331725d578..02cc05a9ae6 100644 --- a/searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.h +++ b/searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.h @@ -17,20 +17,18 @@ private: IntegerAttribute *_int_attr; const IDocumentWeightAttribute *_dwa; - AttributeVector::SP make_attr() { - attribute::Config cfg(attribute::BasicType::INT64, attribute::CollectionType::WSET); - cfg.setFastSearch(true); - return AttributeFactory::createAttribute("my_attribute", cfg); - } + AttributeVector::SP make_attr(); public: - DocumentWeightAttributeHelper() : _attr(make_attr()), - _int_attr(dynamic_cast<IntegerAttribute *>(_attr.get())), - _dwa(_attr->asDocumentWeightAttribute()) + DocumentWeightAttributeHelper() + : _attr(make_attr()), + _int_attr(dynamic_cast<IntegerAttribute *>(_attr.get())), + _dwa(_attr->asDocumentWeightAttribute()) { ASSERT_TRUE(_int_attr != nullptr); ASSERT_TRUE(_dwa != nullptr); } + ~DocumentWeightAttributeHelper(); void add_docs(size_t limit) { AttributeVector::DocId docid; diff --git a/searchlib/src/vespa/searchlib/test/imported_attribute_fixture.h b/searchlib/src/vespa/searchlib/test/imported_attribute_fixture.h index 150b5bf8746..97fc49ce251 100644 --- a/searchlib/src/vespa/searchlib/test/imported_attribute_fixture.h +++ b/searchlib/src/vespa/searchlib/test/imported_attribute_fixture.h @@ -16,6 +16,7 @@ #include <vespa/searchlib/common/i_document_meta_store_context.h> #include <vespa/searchlib/query/query_term_simple.h> #include <vespa/searchcommon/attribute/attributecontent.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/testkit/test_kit.h> namespace search { diff --git a/searchsummary/src/vespa/searchsummary/test/mock_attribute_manager.cpp b/searchsummary/src/vespa/searchsummary/test/mock_attribute_manager.cpp index bf64231e2fd..76e6934b0c9 100644 --- a/searchsummary/src/vespa/searchsummary/test/mock_attribute_manager.cpp +++ b/searchsummary/src/vespa/searchsummary/test/mock_attribute_manager.cpp @@ -2,10 +2,10 @@ #include "mock_attribute_manager.h" #include <vespa/searchlib/attribute/attributefactory.h> -#include <vespa/searchlib/attribute/attributevector.h> #include <vespa/searchlib/attribute/floatbase.h> #include <vespa/searchlib/attribute/integerbase.h> #include <vespa/searchlib/attribute/stringbase.h> +#include <vespa/searchcommon/attribute/config.h> #include <cassert> using search::attribute::BasicType; diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp index 1e091d9a6d8..2b58f728428 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp @@ -12,6 +12,7 @@ #include <vespa/searchlib/common/packets.h> #include <vespa/searchlib/uca/ucaconverter.h> #include <vespa/searchlib/features/setup.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/geo/zcurve.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/util/exceptions.h> diff --git a/vespalib/src/vespa/vespalib/util/growstrategy.h b/vespalib/src/vespa/vespalib/util/growstrategy.h index efac26ce19d..c46c0b45667 100644 --- a/vespalib/src/vespa/vespalib/util/growstrategy.h +++ b/vespalib/src/vespa/vespalib/util/growstrategy.h @@ -29,6 +29,9 @@ public: float getGrowFactor() const noexcept { return _growFactor; } size_t getGrowDelta() const noexcept { return _growDelta; } + void setInitialCapacity(size_t v) noexcept { _initialCapacity = v; } + void setGrowDelta(size_t v) noexcept { _growDelta = v; } + bool operator==(const GrowStrategy & rhs) const noexcept { return (_initialCapacity == rhs._initialCapacity && _minimumCapacity == rhs._minimumCapacity && |