aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/server/documentretriever_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'searchcore/src/tests/proton/server/documentretriever_test.cpp')
-rw-r--r--searchcore/src/tests/proton/server/documentretriever_test.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/searchcore/src/tests/proton/server/documentretriever_test.cpp b/searchcore/src/tests/proton/server/documentretriever_test.cpp
index e631388c9b8..b4236ba4e3e 100644
--- a/searchcore/src/tests/proton/server/documentretriever_test.cpp
+++ b/searchcore/src/tests/proton/server/documentretriever_test.cpp
@@ -20,6 +20,7 @@
#include <vespa/document/fieldset/fieldsets.h>
#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/test/fieldvalue_helpers.h>
#include <vespa/eval/eval/simple_value.h>
#include <vespa/eval/eval/tensor_spec.h>
#include <vespa/eval/eval/value.h>
@@ -66,6 +67,7 @@ using document::StructFieldValue;
using document::TensorDataType;
using document::TensorFieldValue;
using document::WeightedSetFieldValue;
+using document::WSetHelper;
using search::AttributeFactory;
using search::AttributeGuard;
using search::AttributeVector;
@@ -160,12 +162,12 @@ struct MyDocumentStore : proton::test::DummyDocumentStore {
const DocumentType *doc_type = r.getDocumentType(doc_type_name);
auto doc = std::make_unique<Document>(*doc_type, doc_id);
ASSERT_TRUE(doc);
- doc->set(static_field, static_value);
- doc->set(dyn_field_i, static_value);
- doc->set(dyn_field_s, static_value_s);
- doc->set(dyn_field_nai, static_value);
- doc->set(dyn_field_nas, static_value_s);
- doc->set(zcurve_field, static_zcurve_value);
+ doc->setValue(static_field, IntFieldValue::make(static_value));
+ doc->setValue(dyn_field_i, IntFieldValue::make(static_value));
+ doc->setValue(dyn_field_s, StringFieldValue::make(static_value_s));
+ doc->setValue(dyn_field_nai, IntFieldValue::make(static_value));
+ doc->setValue(dyn_field_nas, StringFieldValue::make(static_value_s));
+ doc->setValue(zcurve_field, LongFieldValue::make(static_zcurve_value));
doc->setValue(dyn_field_p, static_value_p);
TensorFieldValue tensorFieldValue(tensorDataType);
tensorFieldValue = SimpleValue::from_value(*static_tensor);
@@ -173,8 +175,8 @@ struct MyDocumentStore : proton::test::DummyDocumentStore {
if (_set_position_struct_field) {
FieldValue::UP fv = PositionDataType::getInstance().createFieldValue();
auto &pos = dynamic_cast<StructFieldValue &>(*fv);
- pos.set(PositionDataType::FIELD_X, 42);
- pos.set(PositionDataType::FIELD_Y, 21);
+ pos.setValue(PositionDataType::FIELD_X, IntFieldValue::make(42));
+ pos.setValue(PositionDataType::FIELD_Y, IntFieldValue::make(21));
doc->setValue(doc->getField(position_field), *fv);
}
@@ -430,10 +432,11 @@ template <typename T>
void checkWset(FieldValue::UP wset, T v) {
ASSERT_TRUE(wset);
auto *wset_val = dynamic_cast<WeightedSetFieldValue *>(wset.get());
+ WSetHelper val(*wset_val);
ASSERT_TRUE(wset_val);
ASSERT_EQUAL(2u, wset_val->size());
- EXPECT_EQUAL(dyn_weight, wset_val->get(v));
- EXPECT_EQUAL(dyn_weight, wset_val->get(v + 1));
+ EXPECT_EQUAL(dyn_weight, val.get(v));
+ EXPECT_EQUAL(dyn_weight, val.get(v + 1));
}
TEST_F("require that attributes are patched into stored document", Fixture) {