aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@yahoo-inc.com>2017-03-24 14:45:54 +0000
committerTor Brede Vekterli <vekterli@yahoo-inc.com>2017-04-03 13:00:54 +0000
commit412be26e9a6fbc187868feca3c3241e3e81d101b (patch)
treef73470b9a7799c2ddeda4ff34324265d25b11f96 /searchlib/src/tests
parentbfb6d99937123fa786ba3e79516a97740b73445b (diff)
Add dense and sparse dot product support for imported attributes
Uses AttributeContent to fetch values from target attribute. Value types are always treated as 64 bits due to AttributeContent API restrictions. Remove explicit AttributeManager use in feature test fixtures to avoid dependencies on anything but IAttributeVector.
Diffstat (limited to 'searchlib/src/tests')
-rw-r--r--searchlib/src/tests/features/euclidean_distance/euclidean_distance_test.cpp2
-rw-r--r--searchlib/src/tests/features/featurebenchmark.cpp14
-rw-r--r--searchlib/src/tests/features/imported_dot_product/CMakeLists.txt9
-rw-r--r--searchlib/src/tests/features/imported_dot_product/imported_dot_product_test.cpp233
-rw-r--r--searchlib/src/tests/features/prod_features.cpp32
-rw-r--r--searchlib/src/tests/features/prod_features_attributematch.cpp4
-rw-r--r--searchlib/src/tests/features/tensor/tensor_test.cpp2
-rw-r--r--searchlib/src/tests/features/tensor_from_labels/tensor_from_labels_test.cpp2
-rw-r--r--searchlib/src/tests/features/tensor_from_weighted_set/tensor_from_weighted_set_test.cpp2
9 files changed, 271 insertions, 29 deletions
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 b0d97902728..b947f1a71e2 100644
--- a/searchlib/src/tests/features/euclidean_distance/euclidean_distance_test.cpp
+++ b/searchlib/src/tests/features/euclidean_distance/euclidean_distance_test.cpp
@@ -76,7 +76,7 @@ struct ExecFixture
for (const auto &attr : attrs) {
attr->addReservedDoc();
attr->addDocs(1);
- test.getIndexEnv().getAttributeManager().add(attr);
+ test.getIndexEnv().getAttributeMap().add(attr);
}
IntegerAttribute *aint = static_cast<IntegerAttribute *>(attrs[0].get());
diff --git a/searchlib/src/tests/features/featurebenchmark.cpp b/searchlib/src/tests/features/featurebenchmark.cpp
index ed8af1cdf14..a20ec88fef3 100644
--- a/searchlib/src/tests/features/featurebenchmark.cpp
+++ b/searchlib/src/tests/features/featurebenchmark.cpp
@@ -356,7 +356,7 @@ Benchmark::runAttributeMatch(Config & cfg)
FtFeatureTest ft(_factory, feature);
ft.getIndexEnv().getBuilder().addField(FieldType::ATTRIBUTE, CollectionType::SINGLE, "foo");
- ft.getIndexEnv().getAttributeManager().add(createAttributeVector("foo", "single", numDocs, 10, 10));
+ ft.getIndexEnv().getAttributeMap().add(createAttributeVector("foo", "single", numDocs, 10, 10));
ft.getQueryEnv().getBuilder().addAttributeNode("foo");
setupPropertyMap(ft.getIndexEnv().getProperties(), cfg.getUnknown());
ASSERT_TRUE(ft.setup());
@@ -398,7 +398,7 @@ Benchmark::runAttribute(Config & cfg)
FtFeatureTest ft(_factory, feature);
ft.getIndexEnv().getBuilder().addField(FieldType::ATTRIBUTE, CollectionType::WEIGHTEDSET, "foo");
- ft.getIndexEnv().getAttributeManager().add(createStringAttributeVector("foo", "wset", numDocs, values));
+ ft.getIndexEnv().getAttributeMap().add(createStringAttributeVector("foo", "wset", numDocs, values));
ASSERT_TRUE(ft.setup());
MatchDataBuilder::UP mdb = ft.createMatchDataBuilder();
@@ -438,15 +438,15 @@ Benchmark::runDotProduct(Config & cfg)
values.add(vespalib::make_string("str%u", i));
}
- ft.getIndexEnv().getAttributeManager().add(createStringAttributeVector("wsstr", collectionType, numDocs, values));
+ ft.getIndexEnv().getAttributeMap().add(createStringAttributeVector("wsstr", collectionType, numDocs, values));
} else if (dataType == "int") {
- ft.getIndexEnv().getAttributeManager().add(createAttributeVector(AVBT::INT32, "wsstr", collectionType, numDocs, 0, numValues));
+ ft.getIndexEnv().getAttributeMap().add(createAttributeVector(AVBT::INT32, "wsstr", collectionType, numDocs, 0, numValues));
} else if (dataType == "long") {
- ft.getIndexEnv().getAttributeManager().add(createAttributeVector(AVBT::INT64, "wsstr", collectionType, numDocs, 0, numValues));
+ ft.getIndexEnv().getAttributeMap().add(createAttributeVector(AVBT::INT64, "wsstr", collectionType, numDocs, 0, numValues));
} else if (dataType == "float") {
- ft.getIndexEnv().getAttributeManager().add(createAttributeVector(AVBT::FLOAT, "wsstr", collectionType, numDocs, 0, numValues));
+ ft.getIndexEnv().getAttributeMap().add(createAttributeVector(AVBT::FLOAT, "wsstr", collectionType, numDocs, 0, numValues));
} else if (dataType == "double") {
- ft.getIndexEnv().getAttributeManager().add(createAttributeVector(AVBT::DOUBLE, "wsstr", collectionType, numDocs, 0, numValues));
+ ft.getIndexEnv().getAttributeMap().add(createAttributeVector(AVBT::DOUBLE, "wsstr", collectionType, numDocs, 0, numValues));
} else {
std::cerr << "Illegal data type '" << dataType << std::endl;
}
diff --git a/searchlib/src/tests/features/imported_dot_product/CMakeLists.txt b/searchlib/src/tests/features/imported_dot_product/CMakeLists.txt
new file mode 100644
index 00000000000..1216b7e8906
--- /dev/null
+++ b/searchlib/src/tests/features/imported_dot_product/CMakeLists.txt
@@ -0,0 +1,9 @@
+# Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+vespa_add_executable(searchlib_imported_dot_product_test_app TEST
+ SOURCES
+ imported_dot_product_test.cpp
+ DEPENDS
+ searchlib
+ searchlib_test
+)
+vespa_add_test(NAME searchlib_imported_dot_product_test_app COMMAND searchlib_imported_dot_product_test_app)
diff --git a/searchlib/src/tests/features/imported_dot_product/imported_dot_product_test.cpp b/searchlib/src/tests/features/imported_dot_product/imported_dot_product_test.cpp
new file mode 100644
index 00000000000..a01b1ad1575
--- /dev/null
+++ b/searchlib/src/tests/features/imported_dot_product/imported_dot_product_test.cpp
@@ -0,0 +1,233 @@
+// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include <vespa/searchlib/features/dotproductfeature.h>
+#include <vespa/searchlib/test/imported_attribute_fixture.h>
+#include <vespa/searchlib/fef/test/ftlib.h>
+#include <vespa/searchlib/fef/test/rankresult.h>
+#include <vespa/searchlib/fef/test/dummy_dependency_handler.h>
+
+using namespace search;
+using namespace search::attribute;
+using namespace search::features;
+using namespace search::fef;
+using namespace search::fef::test;
+
+template <typename T>
+std::unique_ptr<fef::Anything> create_param(const vespalib::string& param) {
+ Properties props;
+ props.add("foo", param);
+ return std::make_unique<dotproduct::ArrayParam<T>>(props.lookup("foo"));
+}
+
+struct FixtureBase : ImportedAttributeFixture {
+
+ BlueprintFactory _factory;
+ FixtureBase() {
+ DotProductBlueprint bp;
+ _factory.addPrototype(bp.createInstance());
+ }
+
+ // Both array and wset attributes can have integer "key" types, so we let specific
+ // sub-fixtures implement the mappings.
+ virtual void setup_integer_mappings(BasicType int_type) = 0;
+
+ void check_single_execution(feature_t expected,
+ const vespalib::string& vector,
+ DocId doc_id,
+ std::unique_ptr<fef::Anything> pre_parsed = std::unique_ptr<fef::Anything>()) {
+ RankResult result;
+ result.addScore("dotProduct(" + imported_attr->getName() + ",vector)", expected);
+ result.setEpsilon(0.00001);
+ FtFeatureTest feature(_factory, result.getKeys());
+
+ feature.getQueryEnv().getProperties().add("dotProduct.vector", vector);
+ if (pre_parsed) {
+ feature.getQueryEnv().getObjectStore().add("dotProduct.vector.object", std::move(pre_parsed));
+ }
+ feature.getIndexEnv().getAttributeMap().add(imported_attr);
+ fef::CollectionType collection_type(
+ (imported_attr->getCollectionType() == attribute::CollectionType::ARRAY)
+ ? fef::CollectionType::ARRAY : fef::CollectionType::WEIGHTEDSET);
+ feature.getIndexEnv().getBuilder().addField(
+ FieldType::ATTRIBUTE, collection_type, imported_attr->getName());
+ ASSERT_TRUE(feature.setup());
+ EXPECT_TRUE(feature.execute(result, doc_id));
+ }
+
+ template <typename BaseFullWidthType, typename PerTypeSetupFunctor>
+ void check_executions(PerTypeSetupFunctor setup_func,
+ const std::vector<BasicType>& types,
+ feature_t expected,
+ const vespalib::string& vector,
+ DocId doc_id,
+ const vespalib::string& shared_param = "") {
+ for (auto type : types) {
+ setup_func(type);
+ std::unique_ptr<fef::Anything> pre_parsed;
+ if (!shared_param.empty()) {
+ pre_parsed = create_param<BaseFullWidthType>(shared_param);
+ }
+ check_single_execution(expected, vector, doc_id, std::move(pre_parsed));
+ }
+ }
+
+ void check_all_integer_executions(feature_t expected,
+ const vespalib::string& vector,
+ DocId doc_id,
+ const vespalib::string& shared_param = "") {
+ check_executions<int64_t>([this](auto int_type){ this->setup_integer_mappings(int_type); },
+ {{BasicType::INT32, BasicType::INT64}},
+ expected, vector, doc_id, shared_param);
+ }
+};
+
+struct ArrayFixture : FixtureBase {
+
+ void setup_integer_mappings(BasicType int_type) override {
+ reset_with_array_value_reference_mappings<IntegerAttribute, int64_t>(
+ int_type,
+ {{DocId(1), dummy_gid(3), DocId(3), {{2, 3, 5}}},
+ {DocId(3), dummy_gid(7), DocId(7), {{7, 11}}},
+ {DocId(5), dummy_gid(8), DocId(8), {{13, 17, 19, 23}}}});
+ }
+
+ void setup_float_mappings(BasicType float_type) {
+ reset_with_array_value_reference_mappings<FloatingPointAttribute, double>(
+ float_type,
+ {{DocId(2), dummy_gid(4), DocId(4), {{2.2, 3.3, 5.5}}},
+ {DocId(4), dummy_gid(8), DocId(8), {{7.7, 11.11}}},
+ {DocId(6), dummy_gid(9), DocId(9), {{13.1, 17.2, 19.3, 23.4}}}});
+ }
+
+ template <typename ExpectedType>
+ void check_prepare_state_output(const vespalib::string& input_vector) {
+ FtFeatureTest feature(_factory, "");
+ DotProductBlueprint bp;
+ DummyDependencyHandler dependency_handler(bp);
+ ParameterList params({Parameter(ParameterType::ATTRIBUTE, imported_attr->getName()),
+ Parameter(ParameterType::STRING, "fancyvector")});
+
+ feature.getIndexEnv().getAttributeMap().add(imported_attr);
+ feature.getIndexEnv().getBuilder().addField(
+ FieldType::ATTRIBUTE, fef::CollectionType::ARRAY, imported_attr->getName());
+
+ bp.setup(feature.getIndexEnv(), params);
+ feature.getQueryEnv().getProperties().add("dotProduct.fancyvector", input_vector);
+ auto& obj_store = feature.getQueryEnv().getObjectStore();
+ bp.prepareSharedState(feature.getQueryEnv(), obj_store);
+ // Resulting name is very implementation defined. But at least the tests will break if it changes.
+ const auto* parsed = obj_store.get("dotProduct.fancyvector.object");
+ ASSERT_TRUE(parsed != nullptr);
+ const auto* as_object = dynamic_cast<const ExpectedType*>(parsed);
+ ASSERT_TRUE(as_object != nullptr);
+ // We don't test the parsed output values here; that's the responsibility of other tests.
+ }
+
+ void check_all_float_executions(feature_t expected,
+ const vespalib::string& vector,
+ DocId doc_id,
+ const vespalib::string& shared_param = "") {
+ check_executions<double>([this](auto float_type){ this->setup_float_mappings(float_type); },
+ {{BasicType::FLOAT, BasicType::DOUBLE}},
+ expected, vector, doc_id, shared_param);
+ }
+};
+
+TEST_F("Dense i32/i64 array dot products can be evaluated with string parameter", ArrayFixture) {
+ f.check_all_integer_executions(2*2 + 3*3 + 5*4, "[2 3 4]", DocId(1));
+}
+
+TEST_F("Dense float/double array dot products can be evaluated with string parameter", ArrayFixture) {
+ f.check_all_float_executions(2.2*7.7 + 3.3*11.11 + 5.5*13.13, "[7.7 11.11 13.13]", DocId(2));
+}
+
+TEST_F("Zero-length i32/i64 array query vector evaluates to zero", ArrayFixture) {
+ f.check_all_integer_executions(0, "[]", DocId(1));
+}
+
+TEST_F("Zero-length float/double array query vector evaluates to zero", ArrayFixture) {
+ f.check_all_float_executions(0, "[]", DocId(1));
+}
+
+TEST_F("prepareSharedState emits i64 vector for i32 imported attribute", ArrayFixture) {
+ f.setup_integer_mappings(BasicType::INT32);
+ f.template check_prepare_state_output<dotproduct::ArrayParam<int64_t>>("[101 202 303]");
+}
+
+TEST_F("prepareSharedState emits i64 vector for i64 imported attribute", ArrayFixture) {
+ f.setup_integer_mappings(BasicType::INT64);
+ f.template check_prepare_state_output<dotproduct::ArrayParam<int64_t>>("[101 202 303]");
+}
+
+TEST_F("prepareSharedState emits double vector for float imported attribute", ArrayFixture) {
+ f.setup_float_mappings(BasicType::FLOAT);
+ f.template check_prepare_state_output<dotproduct::ArrayParam<double>>("[10.1 20.2 30.3]");
+}
+
+TEST_F("prepareSharedState emits double vector for double imported attribute", ArrayFixture) {
+ f.setup_float_mappings(BasicType::DOUBLE);
+ f.template check_prepare_state_output<dotproduct::ArrayParam<double>>("[10.1 20.2 30.3]");
+}
+
+TEST_F("Dense i32/i64 array dot product can be evaluated with pre-parsed object parameter", ArrayFixture) {
+ f.check_all_integer_executions(2*5 + 3*6 + 5*7, "[2 3 4]", DocId(1), "[5 6 7]"); // String input is ignored in favor of stored object
+}
+
+TEST_F("Dense float/double array dot product can be evaluated with pre-parsed object parameter", ArrayFixture) {
+ f.check_all_float_executions(2.2*7.7 + 3.3*11.11 + 5.5*13.13, "[2.0 3.0 4.0]", DocId(2), "[7.7 11.11 13.13]");
+}
+
+TEST_F("Sparse i32/i64 array dot products can be evaluated with string parameter", ArrayFixture) {
+ // Have an outlier index to prevent auto-flattening of sparse input
+ f.check_all_integer_executions(2*13 + 4*23, "{0:2,3:4,50:100}", DocId(5));
+}
+
+TEST_F("Sparse float/double array dot products can be evaluated with string parameter", ArrayFixture) {
+ f.check_all_float_executions(2.5*13.1 + 4.25*23.4, "{0:2.5,3:4.25,50:100.1}", DocId(6));
+}
+
+TEST_F("Sparse i32/i64 array dot products can be evaluated with pre-parsed object parameter", ArrayFixture) {
+ // As before, we cheat a bit by having a different raw string vector than the pre-parsed vector.
+ f.check_all_integer_executions(2*13 + 4*23, "[0 0 0]", DocId(5), "{0:2,3:4,50:100}");
+}
+
+TEST_F("Sparse float/double array dot products can be evaluated with pre-parsed object parameter", ArrayFixture) {
+ f.check_all_float_executions(2.5*13.1 + 4.25*23.4, "[0 0 0]", DocId(6), "{0:2.5,3:4.25,50:100.1}");
+}
+
+struct WsetFixture : FixtureBase {
+ void setup_integer_mappings(BasicType int_type) override {
+ const std::vector<WeightedInt> doc7_values({WeightedInt(200, 7), WeightedInt(300, 13)});
+ reset_with_wset_value_reference_mappings<IntegerAttribute, WeightedInt>(
+ int_type,
+ {{DocId(3), dummy_gid(7), DocId(7), doc7_values}});
+ }
+};
+
+TEST_F("i32/i64 wset dot products can be evaluated with string parameter", WsetFixture) {
+ f.check_all_integer_executions(21*7 + 19*13, "{200:21,300:19,999:1234}", DocId(3));
+}
+
+TEST_F("string wset dot products can be evaluated with string parameter", WsetFixture) {
+ std::vector<WeightedString> doc7_values{{WeightedString("bar", 7), WeightedString("baz", 41)}};
+ reset_with_wset_value_reference_mappings<StringAttribute, WeightedString>(
+ f, BasicType::STRING,
+ {{DocId(3), dummy_gid(7), DocId(7), doc7_values}});
+ f.check_single_execution(5*7 + 3*41, "{bar:5,baz:3,nosuchkey:1234}", DocId(3));
+}
+
+TEST_F("integer enum dot products can be evaluated with string parameter", WsetFixture) {
+ const std::vector<WeightedInt> doc7_values({WeightedInt(200, 7), WeightedInt(300, 13)});
+ // We only check i32 here, since the enum (fast search) aspect is what matters here.
+ reset_with_wset_value_reference_mappings<IntegerAttribute, WeightedInt>(
+ f, BasicType::INT32,
+ {{DocId(3), dummy_gid(7), DocId(7), doc7_values}},
+ FastSearchConfig::ExplicitlyEnabled);
+ f.check_single_execution(21*7 + 19*13, "{200:21,300:19,999:1234}", DocId(3));
+}
+
+// Observed TODOs out of scope for these tests:
+// - pre-parsed vectors not currently implemented for weighted sets.
+// - non-imported cases should also be tested for prepareSharedState.
+
+TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchlib/src/tests/features/prod_features.cpp b/searchlib/src/tests/features/prod_features.cpp
index 4efd140b871..3bdb1faa240 100644
--- a/searchlib/src/tests/features/prod_features.cpp
+++ b/searchlib/src/tests/features/prod_features.cpp
@@ -209,7 +209,7 @@ Test::setupForAgeTest(FtFeatureTest & ft, uint64_t docTime)
ft.getIndexEnv().getBuilder().addField(FieldType::ATTRIBUTE, CollectionType::SINGLE, "doctime");
doctime->addReservedDoc();
doctime->addDocs(1);
- ft.getIndexEnv().getAttributeManager().add(doctime);
+ ft.getIndexEnv().getAttributeMap().add(doctime);
(static_cast<IntegerAttribute *>(doctime.get()))->update(1, docTime);
doctime->commit();
}
@@ -395,7 +395,7 @@ Test::setupForAttributeTest(FtFeatureTest &ft, bool setup_env)
for (uint32_t i = 0; i < avs.size(); ++i) {
avs[i]->addReservedDoc();
avs[i]->addDocs(1);
- ft.getIndexEnv().getAttributeManager().add(avs[i]);
+ ft.getIndexEnv().getAttributeMap().add(avs[i]);
}
// integer attributes
@@ -831,7 +831,7 @@ Test::testDistance()
FtFeatureTest ft(_factory, "distance(pos)");
AttributePtr pos = AttributeFactory::createAttribute("pos", AVC(AVBT::FLOAT, AVCT::SINGLE));
pos->commit();
- ft.getIndexEnv().getAttributeManager().add(pos);
+ ft.getIndexEnv().getAttributeMap().add(pos);
ft.getQueryEnv().getLocation().setValid(true);
ASSERT_TRUE(ft.setup());
ASSERT_TRUE(ft.execute(RankResult().addScore("distance(pos)", 6400000000.0)));
@@ -840,7 +840,7 @@ Test::testDistance()
FtFeatureTest ft(_factory, "distance(pos)");
AttributePtr pos = AttributeFactory::createAttribute("pos", AVC(AVBT::STRING, AVCT::SINGLE));
pos->commit();
- ft.getIndexEnv().getAttributeManager().add(pos);
+ ft.getIndexEnv().getAttributeMap().add(pos);
ft.getQueryEnv().getLocation().setValid(true);
ASSERT_TRUE(ft.setup());
ASSERT_TRUE(ft.execute(RankResult().addScore("distance(pos)", 6400000000.0)));
@@ -849,7 +849,7 @@ Test::testDistance()
FtFeatureTest ft(_factory, "distance(pos)");
AttributePtr pos = AttributeFactory::createAttribute("pos", AVC(AVBT::INT64, AVCT::WSET));
pos->commit();
- ft.getIndexEnv().getAttributeManager().add(pos);
+ ft.getIndexEnv().getAttributeMap().add(pos);
ft.getQueryEnv().getLocation().setValid(true);
ASSERT_TRUE(ft.setup());
ASSERT_TRUE(ft.execute(RankResult().addScore("distance(pos)", 6400000000.0)));
@@ -866,7 +866,7 @@ Test::setupForDistanceTest(FtFeatureTest &ft, const vespalib::string & attrName,
pos->addReservedDoc();
pos->addDocs(1);
- ft.getIndexEnv().getAttributeManager().add(pos);
+ ft.getIndexEnv().getAttributeMap().add(pos);
IntegerAttribute * ia = static_cast<IntegerAttribute *>(pos.get());
for (uint32_t i = 0; i < positions.size(); ++i) {
@@ -984,7 +984,7 @@ Test::testDistanceToPath()
FtFeatureTest ft(_factory, "distanceToPath(pos)");
AttributePtr att = AttributeFactory::createAttribute("pos", AVC(AVBT::FLOAT, AVCT::SINGLE));
att->commit();
- ft.getIndexEnv().getAttributeManager().add(att);
+ ft.getIndexEnv().getAttributeMap().add(att);
ft.getQueryEnv().getProperties().add("distanceToPath(pos).path", "0 0 1 1");
ASSERT_TRUE(ft.setup());
ASSERT_TRUE(ft.execute(res));
@@ -994,7 +994,7 @@ Test::testDistanceToPath()
FtFeatureTest ft(_factory, "distanceToPath(pos)");
AttributePtr att = AttributeFactory::createAttribute("pos", AVC(AVBT::STRING, AVCT::SINGLE));
att->commit();
- ft.getIndexEnv().getAttributeManager().add(att);
+ ft.getIndexEnv().getAttributeMap().add(att);
ft.getQueryEnv().getProperties().add("distanceToPath(pos).path", "0 0 1 1");
ASSERT_TRUE(ft.setup());
ASSERT_TRUE(ft.execute(res));
@@ -1004,7 +1004,7 @@ Test::testDistanceToPath()
FtFeatureTest ft(_factory, "distanceToPath(pos)");
AttributePtr att = AttributeFactory::createAttribute("pos", AVC(AVBT::INT64, AVCT::WSET));
att->commit();
- ft.getIndexEnv().getAttributeManager().add(att);
+ ft.getIndexEnv().getAttributeMap().add(att);
ft.getQueryEnv().getProperties().add("distanceToPath(pos).path", "0 0 1 1");
ASSERT_TRUE(ft.setup());
ASSERT_TRUE(ft.execute(res));
@@ -1037,7 +1037,7 @@ Test::setupForDocumentTest(FtFeatureTest &ft, const vespalib::string & attrName,
type->addReservedDoc();
type->addDocs(1);
- ft.getIndexEnv().getAttributeManager().add(type);
+ ft.getIndexEnv().getAttributeMap().add(type);
(static_cast<StringAttribute *>(type.get()))->update(1, docType);
type->commit();
@@ -1066,8 +1066,8 @@ Test::testDotProduct()
{ // string enum vector
FtFeatureTest ft(_factory, "value(0)");
setupForDotProductTest(ft);
- search::AttributeGuard::UP ag(ft.getIndexEnv().getAttributeManager().getAttribute("wsstr"));
- const search::attribute::IAttributeVector * sv = ag->operator->();
+ const search::attribute::IAttributeVector * sv(ft.getIndexEnv().getAttributeMap().getAttribute("wsstr"));
+ ASSERT_TRUE(sv != nullptr);
EXPECT_TRUE(sv->hasEnum());
search::attribute::EnumHandle e;
{
@@ -1271,7 +1271,7 @@ Test::setupForDotProductTest(FtFeatureTest & ft)
cfg.name);
baf->addReservedDoc();
baf->addDocs(2);
- ft.getIndexEnv().getAttributeManager().add(baf);
+ ft.getIndexEnv().getAttributeMap().add(baf);
for (size_t i(1); i < 6; i++) {
IntegerAttribute * ia = dynamic_cast<IntegerAttribute *>(baf.get());
if (ia) {
@@ -1288,9 +1288,9 @@ Test::setupForDotProductTest(FtFeatureTest & ft)
c->addReservedDoc();
a->addDocs(2);
c->addDocs(2);
- ft.getIndexEnv().getAttributeManager().add(a);
- ft.getIndexEnv().getAttributeManager().add(c);
- ft.getIndexEnv().getAttributeManager().add(d);
+ ft.getIndexEnv().getAttributeMap().add(a);
+ ft.getIndexEnv().getAttributeMap().add(c);
+ ft.getIndexEnv().getAttributeMap().add(d);
StringAttribute * sa = static_cast<StringAttribute *>(a.get());
sa->append(1, "a", 1);
diff --git a/searchlib/src/tests/features/prod_features_attributematch.cpp b/searchlib/src/tests/features/prod_features_attributematch.cpp
index fc69061b4ef..7ccfd1dea1a 100644
--- a/searchlib/src/tests/features/prod_features_attributematch.cpp
+++ b/searchlib/src/tests/features/prod_features_attributematch.cpp
@@ -283,8 +283,8 @@ Test::testAttributeMatch()
AttributePtr wint = AttributeFactory::createAttribute("wint", AVC(AVBT::INT32, AVCT::WSET));
aint->addReservedDoc();
wint->addReservedDoc();
- ft.getIndexEnv().getAttributeManager().add(aint);
- ft.getIndexEnv().getAttributeManager().add(wint);
+ ft.getIndexEnv().getAttributeMap().add(aint);
+ ft.getIndexEnv().getAttributeMap().add(wint);
aint->addDocs(1);
aint->commit();
ASSERT_TRUE(aint->getValueCount(0) == 0);
diff --git a/searchlib/src/tests/features/tensor/tensor_test.cpp b/searchlib/src/tests/features/tensor/tensor_test.cpp
index 34a5df23395..a2477b1cc8e 100644
--- a/searchlib/src/tests/features/tensor/tensor_test.cpp
+++ b/searchlib/src/tests/features/tensor/tensor_test.cpp
@@ -111,7 +111,7 @@ struct ExecFixture
attr->clearDoc(1);
attr->clearDoc(2);
attr->commit();
- test.getIndexEnv().getAttributeManager().add(attr);
+ test.getIndexEnv().getAttributeMap().add(attr);
}
TensorAttribute *tensorAttr =
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 6f413da004c..565184cb7e5 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
@@ -99,7 +99,7 @@ struct ExecFixture
for (const auto &attr : attrs) {
attr->addReservedDoc();
attr->addDocs(1);
- test.getIndexEnv().getAttributeManager().add(attr);
+ test.getIndexEnv().getAttributeMap().add(attr);
}
StringAttribute *astr = static_cast<StringAttribute *>(attrs[0].get());
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 d8dec88c418..171c7791877 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
@@ -100,7 +100,7 @@ struct ExecFixture
for (const auto &attr : attrs) {
attr->addReservedDoc();
attr->addDocs(1);
- test.getIndexEnv().getAttributeManager().add(attr);
+ test.getIndexEnv().getAttributeMap().add(attr);
}
StringAttribute *wsstr = static_cast<StringAttribute *>(attrs[0].get());