summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/attribute/searchable
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@verizonmedia.com>2020-01-29 11:26:48 +0000
committerTor Brede Vekterli <vekterli@verizonmedia.com>2020-01-29 12:22:05 +0000
commitbb74faa5f2e56c930db1ec06ebf912e5b316c087 (patch)
tree42860f1ae5821dea25b900270a5aa1721e4618e7 /searchlib/src/tests/attribute/searchable
parentb525ae9930ce37017eec664fbc4a0e12258c3db0 (diff)
Add ReadableAttributeVector accessor to IAttributeManager
Provides a unified interface for fetching both regular as well as imported attributes. Exposing `ReadableAttributeVector` instead of raw `AttributeVector` instances enforces that all access is done via appropriate acquired read guards. Refactor document selection processing code to use the new interface in order to prepare for imported field support in selections.
Diffstat (limited to 'searchlib/src/tests/attribute/searchable')
-rw-r--r--searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp9
-rw-r--r--searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp4
2 files changed, 13 insertions, 0 deletions
diff --git a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp
index 4818287b429..2eafeab20bd 100644
--- a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp
+++ b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp
@@ -123,6 +123,15 @@ public:
return IAttributeContext::UP();
}
+ std::shared_ptr<attribute::ReadableAttributeVector> readable_attribute_vector(const string& name) const override {
+ if (name == field) {
+ return _attribute_vector;
+ } else if (name == other) {
+ return _other;
+ }
+ return {};
+ }
+
void asyncForAttribute(const vespalib::string &name, std::unique_ptr<IAttributeFunctor> func) const override;
};
diff --git a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp
index e9addae07b9..24be21f65ec 100644
--- a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp
+++ b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp
@@ -100,6 +100,10 @@ public:
void asyncForAttribute(const vespalib::string &, std::unique_ptr<IAttributeFunctor>) const override {
assert(!"Not implemented");
}
+
+ std::shared_ptr<attribute::ReadableAttributeVector> readable_attribute_vector(const string&) const override {
+ return _attribute_vector;
+ }
};
constexpr uint32_t DOCID_LIMIT = 3;