diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-05-25 21:46:53 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-05-25 22:41:37 +0000 |
commit | 25b997ae63728660e5e0d18f9f3965a392245b8d (patch) | |
tree | 30362450b86c7d63a1bdd28747edc8d732612d07 /searchlib/src | |
parent | 1aa60e70335ef3397d3a987df7ffcf111fad4f7f (diff) |
Include searchcommon/attribut/config.h yourself and prepare for hiding large implementation.
Add setters to vespalib::GrowStrategy.
Diffstat (limited to 'searchlib/src')
64 files changed, 290 insertions, 154 deletions
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 { |