summaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/attribute/attribute_aspect_delayer/attribute_aspect_delayer_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'searchcore/src/tests/proton/attribute/attribute_aspect_delayer/attribute_aspect_delayer_test.cpp')
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_aspect_delayer/attribute_aspect_delayer_test.cpp51
1 files changed, 48 insertions, 3 deletions
diff --git a/searchcore/src/tests/proton/attribute/attribute_aspect_delayer/attribute_aspect_delayer_test.cpp b/searchcore/src/tests/proton/attribute/attribute_aspect_delayer/attribute_aspect_delayer_test.cpp
index 7141dc7baf7..6e73904e031 100644
--- a/searchcore/src/tests/proton/attribute/attribute_aspect_delayer/attribute_aspect_delayer_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_aspect_delayer/attribute_aspect_delayer_test.cpp
@@ -101,15 +101,20 @@ AttributesConfig::Attribute make_fa(const AttributesConfig::Attribute &cfg)
return attr;
}
-SummarymapConfig::Override make_attribute_override(const vespalib::string &name)
+SummarymapConfig::Override make_attribute_override(const vespalib::string &name, const vespalib::string &source)
{
SummarymapConfig::Override override;
override.field = name;
override.command = "attribute";
- override.arguments = name;
+ override.arguments = source;
return override;
}
+SummarymapConfig::Override make_attribute_override(const vespalib::string &name)
+{
+ return make_attribute_override(name, name);
+}
+
SummarymapConfig::Override make_geopos_override(const vespalib::string &name)
{
SummarymapConfig::Override override;
@@ -119,11 +124,35 @@ SummarymapConfig::Override make_geopos_override(const vespalib::string &name)
return override;
}
-SummarymapConfig::Override make_attribute_combiner_override(const vespalib::string &name)
+SummarymapConfig::Override make_attribute_combiner_override(const vespalib::string &name, const vespalib::string &source)
{
SummarymapConfig::Override override;
override.field = name;
override.command = "attributecombiner";
+ override.arguments = source;
+ return override;
+}
+
+SummarymapConfig::Override make_attribute_combiner_override(const vespalib::string &name)
+{
+ return make_attribute_combiner_override(name, "");
+}
+
+SummarymapConfig::Override make_matched_attribute_elements_filter_override(const vespalib::string &name, const vespalib::string &source)
+{
+ SummarymapConfig::Override override;
+ override.field = name;
+ override.command = "matchedattributeelementsfilter";
+ override.arguments = source;
+ return override;
+}
+
+SummarymapConfig::Override make_matched_elements_filter_override(const vespalib::string &name, const vespalib::string &source)
+{
+ SummarymapConfig::Override override;
+ override.field = name;
+ override.command = "matchedelementsfilter";
+ override.arguments = source;
return override;
}
@@ -243,6 +272,14 @@ TEST_F(DelayerTest, require_that_adding_attribute_aspect_is_delayed_if_field_typ
assertSummarymapConfig({make_geopos_override("a")});
}
+TEST_F(DelayerTest, require_that_adding_attribute_aspect_is_delayed_if_field_type_is_unchanged_mapped_summary)
+{
+ addFields({"a"});
+ setup(attrCfg({}), smCfg({}), attrCfg({make_int32_sv_cfg()}), sCfg({make_summary_field("a_mapped", "integer")}), smCfg({make_attribute_override("a_mapped", "a")}));
+ assertAttributeConfig({});
+ assertSummarymapConfig({});
+}
+
TEST_F(DelayerTest, require_that_adding_attribute_is_not_delayed_if_field_type_changed)
{
setup(attrCfg({}), smCfg({}), attrCfg({make_int32_sv_cfg()}), sCfg({make_summary_field("a", "integer")}), smCfg({make_attribute_override("a")}));
@@ -390,6 +427,14 @@ TEST_F(DelayerTest, require_that_removing_attribute_aspect_from_struct_field_is_
assertSummarymapConfig({});
}
+TEST_F(DelayerTest, require_that_adding_attribute_aspect_to_struct_field_is_delayed_if_field_type_is_unchanged_with_filtering_docsum)
+{
+ addFields({"array.a"});
+ setup(attrCfg({}), smCfg({}), attrCfg({make_int32_sv_cfg("array.a")}), sCfg({make_summary_field("array", "jsonstring")}), smCfg({make_attribute_combiner_override("array"), make_matched_attribute_elements_filter_override("array_filtered", "array")}));
+ assertAttributeConfig({});
+ assertSummarymapConfig({make_matched_elements_filter_override("array_filtered", "array")});
+}
+
}
GTEST_MAIN_RUN_ALL_TESTS()