summaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/matching
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 /searchcore/src/tests/proton/matching
parent2966d36270a364b0d1421fa3c5dfffdca7a8a26d (diff)
use SimpleValue instead of EngineOrFactory
Diffstat (limited to 'searchcore/src/tests/proton/matching')
-rw-r--r--searchcore/src/tests/proton/matching/matching_test.cpp8
-rw-r--r--searchcore/src/tests/proton/matching/request_context/request_context_test.cpp15
2 files changed, 12 insertions, 11 deletions
diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp
index 3bd5b36aa86..0278aba41d9 100644
--- a/searchcore/src/tests/proton/matching/matching_test.cpp
+++ b/searchcore/src/tests/proton/matching/matching_test.cpp
@@ -32,8 +32,9 @@
#include <vespa/searchcore/proton/matching/match_params.h>
#include <vespa/searchcore/proton/matching/match_tools.h>
#include <vespa/searchcore/proton/matching/match_context.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_codec.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/log/log.h>
@@ -58,8 +59,8 @@ using storage::spi::Timestamp;
using search::fef::indexproperties::hitcollector::HeapSize;
using vespalib::nbostream;
+using vespalib::eval::SimpleValue;
using vespalib::eval::TensorSpec;
-using vespalib::eval::EngineOrFactory;
void inject_match_phase_limiting(Properties &setup, const vespalib::string &attribute, size_t max_hits, bool descending)
{
@@ -666,9 +667,8 @@ TEST("require that summary features are filled") {
EXPECT_TRUE(!f[2].is_double());
EXPECT_TRUE(f[2].is_data());
{
- auto engine = EngineOrFactory::get();
nbostream buf(f[2].as_data().data, f[2].as_data().size);
- auto actual = engine.to_spec(*engine.decode(buf));
+ auto actual = spec_from_value(*SimpleValue::from_stream(buf));
auto expect = TensorSpec("tensor(x[3])").add({{"x", 0}}, 0).add({{"x", 1}}, 1).add({{"x", 2}}, 2);
EXPECT_EQUAL(actual, expect);
}
diff --git a/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp b/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
index 4c2ae99c9cd..7b545344e9b 100644
--- a/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
+++ b/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
@@ -1,7 +1,8 @@
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include <vespa/eval/eval/simple_value.h>
+#include <vespa/eval/eval/value_codec.h>
#include <vespa/eval/eval/tensor_spec.h>
-#include <vespa/eval/eval/engine_or_factory.h>
#include <vespa/searchcore/proton/matching/requestcontext.h>
#include <vespa/searchlib/attribute/attribute_blueprint_params.h>
#include <vespa/searchlib/fef/properties.h>
@@ -13,7 +14,7 @@ using search::attribute::IAttributeContext;
using search::attribute::IAttributeFunctor;
using search::attribute::IAttributeVector;
using search::fef::Properties;
-using vespalib::eval::EngineOrFactory;
+using vespalib::eval::SimpleValue;
using vespalib::eval::TensorSpec;
using vespalib::eval::Value;
using namespace proton;
@@ -37,7 +38,7 @@ private:
void insert_tensor_in_properties(const vespalib::string& tensor_name, const Value& tensor_value) {
vespalib::nbostream stream;
- EngineOrFactory::get().encode(tensor_value, stream);
+ encode_value(tensor_value, stream);
_props.add(tensor_name, vespalib::stringref(stream.data(), stream.size()));
}
@@ -48,14 +49,14 @@ public:
_attr_ctx(),
_props(),
_request_ctx(_doom, _attr_ctx, _props, AttributeBlueprintParams()),
- _query_tensor(EngineOrFactory::get().from_spec(TensorSpec("tensor(x[2])")
- .add({{"x", 0}}, 3).add({{"x", 1}}, 5)))
+ _query_tensor(SimpleValue::from_spec(TensorSpec("tensor(x[2])")
+ .add({{"x", 0}}, 3).add({{"x", 1}}, 5)))
{
insert_tensor_in_properties("my_tensor", *_query_tensor);
_props.add("my_string", "foo bar");
}
TensorSpec expected_query_tensor() const {
- return EngineOrFactory::get().to_spec(*_query_tensor);
+ return spec_from_value(*_query_tensor);
}
Value::UP get_query_tensor(const vespalib::string& tensor_name) const {
return _request_ctx.get_query_tensor(tensor_name);
@@ -67,7 +68,7 @@ TEST_F(RequestContextTest, query_tensor_can_be_retrieved)
auto tensor = get_query_tensor("my_tensor");
ASSERT_TRUE(tensor);
EXPECT_TRUE(tensor->is_tensor());
- EXPECT_EQ(expected_query_tensor(), EngineOrFactory::get().to_spec(*tensor));
+ EXPECT_EQ(expected_query_tensor(), spec_from_value(*tensor));
}
TEST_F(RequestContextTest, non_existing_query_tensor_returns_nullptr)