diff options
author | Tor Egge <Tor.Egge@online.no> | 2022-10-13 12:34:35 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2022-10-13 12:34:35 +0200 |
commit | 2b309b0a16f2867509040080face61cfae14f902 (patch) | |
tree | 917c78167aa7b0b053ee87571da872bacf9e2d7b /searchcore | |
parent | 55273728967bc6edea0185f062c93a3e61e6cf66 (diff) |
Add field value builders to EmptyDocBuilder.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/tests/proton/attribute/attribute_test.cpp | 4 | ||||
-rw-r--r-- | searchcore/src/tests/proton/docsummary/docsummary.cpp | 26 |
2 files changed, 15 insertions, 15 deletions
diff --git a/searchcore/src/tests/proton/attribute/attribute_test.cpp b/searchcore/src/tests/proton/attribute/attribute_test.cpp index ea264c506a6..78f2d6bbe01 100644 --- a/searchcore/src/tests/proton/attribute/attribute_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_test.cpp @@ -262,7 +262,7 @@ TEST_F(AttributeWriterTest, handles_put) { // document with single value & multi value attribute auto doc = edb.make_document("id:ns:searchdocument::2"); doc->setValue("a1", IntFieldValue(10)); - ArrayFieldValue int_array(edb.get_data_type("Array<Int>")); + auto int_array = edb.make_array("a2"); int_array.add(IntFieldValue(20)); int_array.add(IntFieldValue(30)); doc->setValue("a2",int_array); @@ -284,7 +284,7 @@ TEST_F(AttributeWriterTest, handles_put) { // replace existing document auto doc = edb.make_document("id:ns:searchdocument::2"); doc->setValue("a1", IntFieldValue(100)); - ArrayFieldValue int_array(edb.get_data_type("Array<Int>")); + auto int_array = edb.make_array("a2"); int_array.add(IntFieldValue(200)); int_array.add(IntFieldValue(300)); int_array.add(IntFieldValue(400)); diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index e76a7f72cbb..09950e708bf 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -627,27 +627,27 @@ TEST("requireThatAttributesAreUsed") doc->setValue("ba", IntFieldValue(10)); doc->setValue("bb", FloatFieldValue(10.1250)); doc->setValue("bc", StringFieldValue("foo")); - ArrayFieldValue int_array(bc.get_data_type("Array<Int>")); + auto int_array = bc.make_array("bd"); int_array.add(IntFieldValue(20)); int_array.add(IntFieldValue(30)); doc->setValue("bd", int_array); - ArrayFieldValue float_array(bc.get_data_type("Array<Float>")); + auto float_array = bc.make_array("be"); float_array.add(FloatFieldValue(20.25000)); float_array.add(FloatFieldValue(30.31250)); doc->setValue("be", float_array); - ArrayFieldValue string_array(bc.get_data_type("Array<String>")); + auto string_array = bc.make_array("bf"); string_array.add(StringFieldValue("bar")); string_array.add(StringFieldValue("baz")); doc->setValue("bf", string_array); - WeightedSetFieldValue int_wset(bc.get_data_type("WeightedSet<Int>")); + auto int_wset = bc.make_wset("bg"); int_wset.add(IntFieldValue(40), 2); int_wset.add(IntFieldValue(50), 3); doc->setValue("bg", int_wset); - WeightedSetFieldValue float_wset(bc.get_data_type("WeightedSet<Float>")); + auto float_wset = bc.make_wset("bh"); float_wset.add(FloatFieldValue(40.4375), 4); float_wset.add(FloatFieldValue(50.5625), 5); doc->setValue("bh", float_wset); - WeightedSetFieldValue string_wset(bc.get_data_type("WeightedSet<String>")); + auto string_wset = bc.make_wset("bi"); string_wset.add(StringFieldValue("quux"), 7); string_wset.add(StringFieldValue("qux"), 6); doc->setValue("bi", string_wset); @@ -774,7 +774,7 @@ TEST_F("requireThatUrisAreUsed", Fixture) .addField("uriwset", Wset(UrlDataType::getInstance().getId())); }); DBContext dc(bc.get_repo_sp(), getDocTypeName()); auto exp = bc.make_document("id:ns:searchdocument::0"); - StructFieldValue uri(bc.get_data_type("url")); + auto uri = bc.make_url(); uri.setValue("all", StringFieldValue("http://www.example.com:81/fluke?ab=2#4")); uri.setValue("scheme", StringFieldValue("http")); uri.setValue("host", StringFieldValue("www.example.com")); @@ -783,7 +783,7 @@ TEST_F("requireThatUrisAreUsed", Fixture) uri.setValue("query", StringFieldValue("ab=2")); uri.setValue("fragment", StringFieldValue("4")); exp->setValue("urisingle", uri); - ArrayFieldValue uri_array(bc.get_data_type("Array<url>")); + auto uri_array = bc.make_array("uriarray"); uri.setValue("all", StringFieldValue("http://www.example.com:82/fluke?ab=2#8")); uri.setValue("scheme", StringFieldValue("http")); uri.setValue("host", StringFieldValue("www.example.com")); @@ -801,7 +801,7 @@ TEST_F("requireThatUrisAreUsed", Fixture) uri.setValue("fragment", StringFieldValue("9")); uri_array.add(uri); exp->setValue("uriarray", uri_array); - WeightedSetFieldValue uri_wset(bc.get_data_type("WeightedSet<url>")); + auto uri_wset = bc.make_wset("uriwset"); uri.setValue("all", StringFieldValue("http://www.example.com:83/fluke?ab=2#12")); uri.setValue("scheme", StringFieldValue("http")); uri.setValue("host", StringFieldValue("www.example.com")); @@ -867,11 +867,11 @@ TEST("requireThatPositionsAreUsed") DBContext dc(bc.get_repo_sp(), getDocTypeName()); auto exp = bc.make_document("id:ns:searchdocument::1"); exp->setValue("sp2", LongFieldValue(ZCurve::encode(1002, 1003))); - ArrayFieldValue pos_array(bc.get_data_type("Array<Long>")); + auto pos_array = bc.make_array("ap2"); pos_array.add(LongFieldValue(ZCurve::encode(1006, 1007))); pos_array.add(LongFieldValue(ZCurve::encode(1008, 1009))); exp->setValue("ap2", pos_array); - WeightedSetFieldValue pos_wset(bc.get_data_type("WeightedSet<Long>")); + auto pos_wset = bc.make_wset("wp2"); pos_wset.add(LongFieldValue(ZCurve::encode(1012, 1013)), 43); pos_wset.add(LongFieldValue(ZCurve::encode(1014, 1015)), 44); exp->setValue("wp2", pos_wset); @@ -928,11 +928,11 @@ TEST_F("requireThatRawFieldsWorks", Fixture) DBContext dc(bc.get_repo_sp(), getDocTypeName()); auto exp = bc.make_document("id:ns:searchdocument::0"); exp->setValue("i", RawFieldValue(raw1s)); - ArrayFieldValue raw_array(bc.get_data_type("Array<Raw>")); + auto raw_array = bc.make_array("araw"); raw_array.add(RawFieldValue(raw1a0)); raw_array.add(RawFieldValue(raw1a1)); exp->setValue("araw", raw_array); - WeightedSetFieldValue raw_wset(bc.get_data_type("WeightedSet<Raw>")); + auto raw_wset = bc.make_wset("wraw"); raw_wset.add(RawFieldValue(raw1w1), 46); raw_wset.add(RawFieldValue(raw1w0), 45); exp->setValue("wraw", raw_wset); |