diff options
author | Tor Egge <Tor.Egge@yahoo-inc.com> | 2017-04-20 09:33:30 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@yahoo-inc.com> | 2017-04-20 09:33:30 +0000 |
commit | c4e71641492b839ccac8004447571b49175fa94f (patch) | |
tree | de74c61857e2fdd3f091b14cc67135fdecf025aa /searchcore | |
parent | ad7d654226f0dde6585d48eda2002f60328cc55a (diff) |
Only delay attribute override changes in summary map config.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/tests/proton/attribute/attribute_specs_builder/attribute_specs_builder_test.cpp | 27 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/attribute/attribute_specs_builder.cpp | 16 |
2 files changed, 38 insertions, 5 deletions
diff --git a/searchcore/src/tests/proton/attribute/attribute_specs_builder/attribute_specs_builder_test.cpp b/searchcore/src/tests/proton/attribute/attribute_specs_builder/attribute_specs_builder_test.cpp index 6fd34e608f8..585ffc88414 100644 --- a/searchcore/src/tests/proton/attribute/attribute_specs_builder/attribute_specs_builder_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_specs_builder/attribute_specs_builder_test.cpp @@ -143,6 +143,15 @@ SummarymapConfig::Override make_attribute_override(const vespalib::string &name) return override; } +SummarymapConfig::Override make_geopos_override(const vespalib::string &name) +{ + SummarymapConfig::Override override; + override.field = name; + override.command = "geopos"; + override.arguments = name; + return override; +} + SummarymapConfig smCfg(std::vector<SummarymapConfig::Override> overrides) { SummarymapConfigBuilder result; @@ -243,6 +252,15 @@ TEST_F("require that adding attribute aspect is delayed if field type is unchang TEST_DO(f.assertSummarymapConfig({})); } +TEST_F("require that adding attribute aspect is delayed if field type is unchanged, geopos override", Fixture) +{ + f.addFields({"a"}); + f.setup(attrCfg({}), smCfg({}), attrCfg({make_int32_sv_cfg()}), smCfg({make_geopos_override("a")})); + TEST_DO(f.assertSpecs({AttributeSpec("a", int32_sv, false, true)})); + TEST_DO(f.assertAttributeConfig({})); + TEST_DO(f.assertSummarymapConfig({make_geopos_override("a")})); +} + TEST_F("require that adding attribute is not delayed if field type changed", Fixture) { f.setup(attrCfg({}), smCfg({}), attrCfg({make_int32_sv_cfg()}), smCfg({make_attribute_override("a")})); @@ -260,6 +278,15 @@ TEST_F("require that removing attribute aspect is delayed if field type is uncha TEST_DO(f.assertSummarymapConfig({make_attribute_override("a")})); } +TEST_F("require that removing attribute aspect is delayed if field type is unchanged, gepos override", Fixture) +{ + f.addFields({"a"}); + f.setup(attrCfg({make_int32_sv_cfg()}), smCfg({make_geopos_override("a")}), attrCfg({}), smCfg({})); + TEST_DO(f.assertSpecs({AttributeSpec("a", int32_sv, true, false)})); + TEST_DO(f.assertAttributeConfig({make_int32_sv_cfg()})); + TEST_DO(f.assertSummarymapConfig({})); +} + TEST_F("require that removing attribute aspect is not delayed if field type changed", Fixture) { f.setup(attrCfg({make_int32_sv_cfg()}), smCfg({make_attribute_override("a")}), attrCfg({}), smCfg({})); diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_specs_builder.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_specs_builder.cpp index 0355b1297f8..9abb02cf2f7 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_specs_builder.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_specs_builder.cpp @@ -130,8 +130,12 @@ handleNewAttributes(const AttributesConfig &oldAttributesConfig, } } for (const auto &override : newSummarymapConfig.override) { - auto itr = delayed.find(override.field); - if (itr == delayed.end()) { + if (override.command == "attribute") { + auto itr = delayed.find(override.field); + if (itr == delayed.end()) { + summarymapConfig.override.emplace_back(override); + } + } else { summarymapConfig.override.emplace_back(override); } } @@ -165,9 +169,11 @@ handleOldAttributes(const AttributesConfig &oldAttributesConfig, } } for (const auto &override : oldSummarymapConfig.override) { - auto itr = delayed.find(override.field); - if (itr != delayed.end()) { - summarymapConfig.override.emplace_back(override); + if (override.command == "attribute") { + auto itr = delayed.find(override.field); + if (itr != delayed.end()) { + summarymapConfig.override.emplace_back(override); + } } } } |