summaryrefslogtreecommitdiffstats
path: root/searchlib/src
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2020-12-01 15:10:59 +0000
committerArne Juul <arnej@verizonmedia.com>2020-12-02 14:14:12 +0000
commit919ec00a9948c24f645daafbaea94183cc931397 (patch)
tree11417c16a7ee0aa1274e1605e21e43b62ccad3ac /searchlib/src
parent2966d36270a364b0d1421fa3c5dfffdca7a8a26d (diff)
use SimpleValue instead of EngineOrFactory
Diffstat (limited to 'searchlib/src')
-rw-r--r--searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp7
-rw-r--r--searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp7
-rw-r--r--searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp9
-rw-r--r--searchlib/src/tests/features/constant/constant_test.cpp10
-rw-r--r--searchlib/src/tests/features/imported_dot_product/imported_dot_product_test.cpp6
-rw-r--r--searchlib/src/tests/features/tensor/tensor_test.cpp36
-rw-r--r--searchlib/src/tests/features/tensor_from_labels/tensor_from_labels_test.cpp7
-rw-r--r--searchlib/src/tests/features/tensor_from_weighted_set/tensor_from_weighted_set_test.cpp6
-rw-r--r--searchlib/src/tests/queryeval/nearest_neighbor/nearest_neighbor_test.cpp7
-rw-r--r--searchlib/src/tests/tensor/dense_tensor_store/dense_tensor_store_test.cpp8
-rw-r--r--searchlib/src/tests/tensor/direct_tensor_store/direct_tensor_store_test.cpp7
11 files changed, 59 insertions, 51 deletions
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 8870593d950..2d30f89015d 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
@@ -1,7 +1,8 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/eval/eval/engine_or_factory.h>
#include <vespa/eval/eval/value.h>
+#include <vespa/eval/eval/simple_value.h>
+#include <vespa/eval/eval/tensor_spec.h>
#include <vespa/eval/eval/test/value_compare.h>
#include <vespa/searchcommon/attribute/search_context_params.h>
#include <vespa/searchlib/fef/termfieldmatchdata.h>
@@ -15,10 +16,10 @@ using search::tensor::TensorAttribute;
using vespalib::eval::Value;
using vespalib::eval::ValueType;
using vespalib::eval::TensorSpec;
-using vespalib::eval::EngineOrFactory;
+using vespalib::eval::SimpleValue;
Value::UP createTensor(const TensorSpec &spec) {
- return EngineOrFactory::get().from_spec(spec);
+ return SimpleValue::from_spec(spec);
}
namespace search::attribute {
diff --git a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp
index dc7dee3770d..afeb89349c7 100644
--- a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp
+++ b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp
@@ -1,6 +1,8 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/tensor_spec.h>
+#include <vespa/eval/eval/value.h>
+#include <vespa/eval/eval/value_codec.h>
#include <vespa/eval/tensor/dense/dense_tensor_view.h>
#include <vespa/searchcommon/attribute/iattributecontext.h>
#include <vespa/searchlib/attribute/attribute_blueprint_factory.h>
@@ -50,7 +52,6 @@ using search::queryeval::SearchIterator;
using std::string;
using std::vector;
using vespalib::eval::TensorSpec;
-using vespalib::eval::EngineOrFactory;
using vespalib::eval::Value;
using vespalib::eval::ValueType;
using namespace search::attribute;
@@ -357,7 +358,7 @@ expect_nearest_neighbor_blueprint(const vespalib::string& attribute_tensor_type_
auto result = f.create_blueprint();
const auto& nearest = downcast<const NearestNeighborBlueprint>(*result);
EXPECT_EQ(attribute_tensor_type_spec, nearest.get_attribute_tensor().getTensorType().to_spec());
- EXPECT_EQ(converted_query_tensor, EngineOrFactory::get().to_spec(nearest.get_query_tensor()));
+ EXPECT_EQ(converted_query_tensor, spec_from_value(nearest.get_query_tensor()));
EXPECT_EQ(7u, nearest.get_target_num_hits());
}
diff --git a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp
index bf46a2cc7d0..e1bd47af358 100644
--- a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp
+++ b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp
@@ -1,7 +1,8 @@
// Copyright 2017 Yahoo Holdings. 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/engine_or_factory.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>
@@ -52,7 +53,7 @@ using vespalib::eval::TensorSpec;
using vespalib::eval::CellType;
using vespalib::eval::ValueType;
using vespalib::eval::Value;
-using vespalib::eval::EngineOrFactory;
+using vespalib::eval::SimpleValue;
using DoubleVector = std::vector<double>;
using generation_t = vespalib::GenerationHandler::generation_t;
@@ -62,7 +63,7 @@ vespalib::string denseSpec("tensor(x[2],y[3])");
vespalib::string vec_2d_spec("tensor(x[2])");
Value::UP createTensor(const TensorSpec &spec) {
- return EngineOrFactory::get().from_spec(spec);
+ return SimpleValue::from_spec(spec);
}
TensorSpec
@@ -904,7 +905,7 @@ public:
}
std::unique_ptr<Value> createDenseTensor(const TensorSpec &spec) {
- return EngineOrFactory::get().from_spec(spec);
+ return SimpleValue::from_spec(spec);
}
std::unique_ptr<NearestNeighborBlueprint> make_blueprint(double brute_force_limit = 0.05) {
diff --git a/searchlib/src/tests/features/constant/constant_test.cpp b/searchlib/src/tests/features/constant/constant_test.cpp
index e513e20a35c..140c93125b0 100644
--- a/searchlib/src/tests/features/constant/constant_test.cpp
+++ b/searchlib/src/tests/features/constant/constant_test.cpp
@@ -6,8 +6,8 @@
#include <vespa/searchlib/fef/test/ftlib.h>
#include <vespa/searchlib/fef/test/indexenvironment.h>
#include <vespa/eval/eval/function.h>
+#include <vespa/eval/eval/simple_value.h>
#include <vespa/eval/eval/tensor_spec.h>
-#include <vespa/eval/eval/engine_or_factory.h>
#include <vespa/eval/eval/value.h>
#include <vespa/eval/eval/test/value_compare.h>
@@ -16,18 +16,18 @@ using namespace search::fef;
using namespace search::fef::indexproperties;
using namespace search::fef::test;
using namespace search::features;
-using vespalib::eval::Function;
-using vespalib::eval::Value;
using vespalib::eval::DoubleValue;
+using vespalib::eval::Function;
+using vespalib::eval::SimpleValue;
using vespalib::eval::TensorSpec;
+using vespalib::eval::Value;
using vespalib::eval::ValueType;
-using vespalib::eval::EngineOrFactory;
namespace
{
Value::UP make_tensor(const TensorSpec &spec) {
- return EngineOrFactory::get().from_spec(spec);
+ return SimpleValue::from_spec(spec);
}
}
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
index ec6aa65c6c2..3c9cf209484 100644
--- 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
@@ -6,7 +6,8 @@
#include <vespa/searchlib/fef/test/ftlib.h>
#include <vespa/searchlib/fef/test/rankresult.h>
#include <vespa/searchlib/fef/test/dummy_dependency_handler.h>
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/simple_value.h>
+#include <vespa/eval/eval/tensor_spec.h>
#include <vespa/eval/eval/value_codec.h>
#include <vespa/vespalib/objects/nbostream.h>
@@ -17,6 +18,7 @@ using namespace search::fef;
using namespace search::fef::test;
using namespace search::index;
+using vespalib::eval::SimpleValue;
using vespalib::eval::TensorSpec;
template <typename T>
@@ -118,7 +120,7 @@ struct ArrayFixture : FixtureBase {
template <typename ExpectedType>
void check_prepare_state_output(const TensorSpec & spec, const ExpectedType & expected) {
- auto value = vespalib::eval::EngineOrFactory::get().from_spec(spec);
+ auto value = SimpleValue::from_spec(spec);
check_prepare_state_output(*value, expected);
}
diff --git a/searchlib/src/tests/features/tensor/tensor_test.cpp b/searchlib/src/tests/features/tensor/tensor_test.cpp
index 188a1347901..53049c4a385 100644
--- a/searchlib/src/tests/features/tensor/tensor_test.cpp
+++ b/searchlib/src/tests/features/tensor/tensor_test.cpp
@@ -11,8 +11,8 @@
#include <vespa/searchlib/fef/test/queryenvironment.h>
#include <vespa/searchlib/tensor/tensor_attribute.h>
#include <vespa/searchlib/tensor/direct_tensor_attribute.h>
-#include <vespa/eval/eval/engine_or_factory.h>
#include <vespa/eval/eval/function.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/value_codec.h>
@@ -28,12 +28,12 @@ using search::AttributeFactory;
using search::tensor::TensorAttribute;
using search::tensor::DirectTensorAttribute;
using search::AttributeVector;
-using vespalib::eval::EngineOrFactory;
using vespalib::eval::Function;
-using vespalib::eval::spec_from_value;
+using vespalib::eval::SimpleValue;
+using vespalib::eval::TensorSpec;
using vespalib::eval::Value;
using vespalib::eval::ValueType;
-using vespalib::eval::TensorSpec;
+using vespalib::eval::spec_from_value;
using AVC = search::attribute::Config;
using AVBT = search::attribute::BasicType;
@@ -46,7 +46,7 @@ namespace
{
Value::UP make_empty(const vespalib::string &type) {
- return EngineOrFactory::get().from_spec(TensorSpec(type));
+ return SimpleValue::from_spec(TensorSpec(type));
}
}
@@ -113,10 +113,10 @@ struct ExecFixture
DirectTensorAttribute *directAttr =
dynamic_cast<DirectTensorAttribute *>(attrs[1].get());
- auto doc_tensor = EngineOrFactory::get().from_spec(TensorSpec("tensor(x{})")
- .add({{"x", "a"}}, 3)
- .add({{"x", "b"}}, 5)
- .add({{"x", "c"}}, 7));
+ auto doc_tensor = SimpleValue::from_spec(TensorSpec("tensor(x{})")
+ .add({{"x", "a"}}, 3)
+ .add({{"x", "b"}}, 5)
+ .add({{"x", "c"}}, 7));
tensorAttr->setTensor(1, *doc_tensor);
directAttr->set_tensor(1, std::move(doc_tensor));
@@ -129,7 +129,7 @@ struct ExecFixture
std::unique_ptr<Value> tensor)
{
vespalib::nbostream stream;
- EngineOrFactory::get().encode(*tensor, stream);
+ encode_value(*tensor, stream);
test.getQueryEnv().getProperties().add(tensorName,
vespalib::stringref(stream.peek(), stream.size()));
setQueryTensorType(tensorName, tensorTypeSpec);
@@ -138,16 +138,16 @@ struct ExecFixture
void setupQueryEnvironment() {
setQueryTensor("tensorquery",
"tensor(q{})",
- EngineOrFactory::get().from_spec(TensorSpec("tensor(q{})")
- .add({{"q", "d"}}, 11 )
- .add({{"q", "e"}}, 13 )
- .add({{"q", "f"}}, 17 )));
+ SimpleValue::from_spec(TensorSpec("tensor(q{})")
+ .add({{"q", "d"}}, 11 )
+ .add({{"q", "e"}}, 13 )
+ .add({{"q", "f"}}, 17 )));
setQueryTensor("mappedtensorquery",
"tensor(x[2])",
- EngineOrFactory::get().from_spec(TensorSpec("tensor(x{},y{})")
- .add({{"x", "0"},{"y", "0"}}, 11 )
- .add({{"x", "0"},{"y", "1"}}, 13 )
- .add({{"x", "1"},{"y", "0"}}, 17 )));
+ SimpleValue::from_spec(TensorSpec("tensor(x{},y{})")
+ .add({{"x", "0"},{"y", "0"}}, 11 )
+ .add({{"x", "0"},{"y", "1"}}, 13 )
+ .add({{"x", "1"},{"y", "0"}}, 17 )));
setQueryTensorType("null", "tensor(q{})");
}
const Value &extractTensor(uint32_t docid) {
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 33fd7c856b3..2e83d2acbf2 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
@@ -12,8 +12,9 @@
#include <vespa/searchlib/fef/test/indexenvironment.h>
#include <vespa/searchlib/fef/test/indexenvironmentbuilder.h>
#include <vespa/searchlib/fef/test/queryenvironment.h>
-#include <vespa/eval/eval/engine_or_factory.h>
#include <vespa/eval/eval/function.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>
@@ -27,7 +28,7 @@ using search::StringAttribute;
using vespalib::eval::Value;
using vespalib::eval::Function;
using vespalib::eval::TensorSpec;
-using vespalib::eval::EngineOrFactory;
+using vespalib::eval::SimpleValue;
typedef search::attribute::Config AVC;
typedef search::attribute::BasicType AVBT;
@@ -36,7 +37,7 @@ typedef search::AttributeVector::SP AttributePtr;
typedef FtTestApp FTA;
Value::UP make_tensor(const TensorSpec &spec) {
- return EngineOrFactory::get().from_spec(spec);
+ return SimpleValue::from_spec(spec);
}
Value::UP make_empty(const vespalib::string &type) {
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 282c8134754..c339d8dae63 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
@@ -12,8 +12,8 @@
#include <vespa/searchlib/fef/test/indexenvironment.h>
#include <vespa/searchlib/fef/test/indexenvironmentbuilder.h>
#include <vespa/searchlib/fef/test/queryenvironment.h>
-#include <vespa/eval/eval/engine_or_factory.h>
#include <vespa/eval/eval/function.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>
@@ -28,7 +28,7 @@ using search::StringAttribute;
using vespalib::eval::Value;
using vespalib::eval::Function;
using vespalib::eval::TensorSpec;
-using vespalib::eval::EngineOrFactory;
+using vespalib::eval::SimpleValue;
typedef search::attribute::Config AVC;
typedef search::attribute::BasicType AVBT;
@@ -37,7 +37,7 @@ typedef search::AttributeVector::SP AttributePtr;
typedef FtTestApp FTA;
Value::UP make_tensor(const TensorSpec &spec) {
- return EngineOrFactory::get().from_spec(spec);
+ return SimpleValue::from_spec(spec);
}
Value::UP make_empty(const vespalib::string &type) {
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 23cb3831b6d..ad450a91f33 100644
--- a/searchlib/src/tests/queryeval/nearest_neighbor/nearest_neighbor_test.cpp
+++ b/searchlib/src/tests/queryeval/nearest_neighbor/nearest_neighbor_test.cpp
@@ -3,7 +3,8 @@
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/stringfmt.h>
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/simple_value.h>
+#include <vespa/eval/eval/tensor_spec.h>
#include <vespa/searchlib/common/bitvector.h>
#include <vespa/searchlib/common/feature.h>
#include <vespa/searchlib/fef/matchdata.h>
@@ -27,7 +28,7 @@ using vespalib::eval::Value;
using vespalib::eval::ValueType;
using vespalib::eval::CellType;
using vespalib::eval::TensorSpec;
-using vespalib::eval::EngineOrFactory;
+using vespalib::eval::SimpleValue;
using search::tensor::DistanceFunction;
using search::attribute::DistanceMetric;
@@ -41,7 +42,7 @@ DistanceFunction::UP euclid_d = search::tensor::make_distance_function(DistanceM
DistanceFunction::UP euclid_f = search::tensor::make_distance_function(DistanceMetric::Euclidean, CellType::FLOAT);
std::unique_ptr<Value> createTensor(const TensorSpec &spec) {
- return EngineOrFactory::get().from_spec(spec);
+ return SimpleValue::from_spec(spec);
}
std::unique_ptr<Value> createTensor(const vespalib::string& type_spec, double v1, double v2) {
diff --git a/searchlib/src/tests/tensor/dense_tensor_store/dense_tensor_store_test.cpp b/searchlib/src/tests/tensor/dense_tensor_store/dense_tensor_store_test.cpp
index 4bdae05e02f..a3b59909ac8 100644
--- a/searchlib/src/tests/tensor/dense_tensor_store/dense_tensor_store_test.cpp
+++ b/searchlib/src/tests/tensor/dense_tensor_store/dense_tensor_store_test.cpp
@@ -3,18 +3,18 @@
LOG_SETUP("dense_tensor_store_test");
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchlib/tensor/dense_tensor_store.h>
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/simple_value.h>
#include <vespa/eval/eval/tensor_spec.h>
-#include <vespa/eval/eval/test/value_compare.h>
#include <vespa/eval/eval/value.h>
#include <vespa/eval/eval/value_type.h>
+#include <vespa/eval/eval/test/value_compare.h>
#include <vespa/eval/tensor/dense/mutable_dense_tensor_view.h>
using search::tensor::DenseTensorStore;
+using vespalib::eval::SimpleValue;
using vespalib::eval::TensorSpec;
using vespalib::eval::Value;
using vespalib::eval::ValueType;
-using vespalib::eval::EngineOrFactory;
using vespalib::tensor::MutableDenseTensorView;
using EntryRef = DenseTensorStore::EntryRef;
@@ -22,7 +22,7 @@ using EntryRef = DenseTensorStore::EntryRef;
Value::UP
makeTensor(const TensorSpec &spec)
{
- return EngineOrFactory::get().from_spec(spec);
+ return SimpleValue::from_spec(spec);
}
struct Fixture
diff --git a/searchlib/src/tests/tensor/direct_tensor_store/direct_tensor_store_test.cpp b/searchlib/src/tests/tensor/direct_tensor_store/direct_tensor_store_test.cpp
index a6f4d56425b..f5160e4b879 100644
--- a/searchlib/src/tests/tensor/direct_tensor_store/direct_tensor_store_test.cpp
+++ b/searchlib/src/tests/tensor/direct_tensor_store/direct_tensor_store_test.cpp
@@ -2,14 +2,15 @@
#include <vespa/searchlib/tensor/direct_tensor_store.h>
#include <vespa/vespalib/gtest/gtest.h>
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/simple_value.h>
+#include <vespa/eval/eval/tensor_spec.h>
#include <vespa/eval/eval/value.h>
#include <vespa/vespalib/datastore/datastore.hpp>
using namespace search::tensor;
using vespalib::datastore::EntryRef;
-using vespalib::eval::EngineOrFactory;
+using vespalib::eval::SimpleValue;
using vespalib::eval::TensorSpec;
using vespalib::eval::Value;
using vespalib::eval::ValueType;
@@ -40,7 +41,7 @@ public:
Value::UP
make_tensor(const TensorSpec& spec)
{
- auto value = EngineOrFactory::get().from_spec(spec);
+ auto value = SimpleValue::from_spec(spec);
return std::make_unique<MockBigTensor>(std::move(value));
}