diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-03-09 11:14:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-09 11:14:44 +0100 |
commit | 7743992d1dd55b635a297ad97546d4fbfd5ce23f (patch) | |
tree | c8997726052067df69055d90128f56d5f4176635 /config-model | |
parent | 9a7cf8a1b204bf62c2cd21ec0d071108c20c9b49 (diff) | |
parent | 9bf4deb908d6d13f8c4a8cd251c82caea084e9a3 (diff) |
Merge pull request #21603 from vespa-engine/arnej/test-match-settings-resolving
Arnej/test match settings resolving
Diffstat (limited to 'config-model')
18 files changed, 911 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java index 0d1222e737b..bd6625d4bde 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java @@ -339,6 +339,7 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer, subFieldMatching.merge(field.getMatching()); SDField subField = structFields.get(field.getName()); if (subField != null) { + subFieldMatching.merge(subField.getMatching()); subField.populateWithStructMatching(sdoc, field.getDataType(), subFieldMatching); subField.setMatching(subFieldMatching); } diff --git a/config-model/src/test/derived/matchsettings_map_after/index-info.cfg b/config-model/src/test/derived/matchsettings_map_after/index-info.cfg new file mode 100644 index 00000000000..374d5071c31 --- /dev/null +++ b/config-model/src/test/derived/matchsettings_map_after/index-info.cfg @@ -0,0 +1,35 @@ +indexinfo[].name "test" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "word" +indexinfo[].command[].indexname "mse4.key" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4.key" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mse4.key" +indexinfo[].command[].command "exact @mse4_key@" +indexinfo[].command[].indexname "mse4.value.sf1s" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4.value.sf1s" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mse4.value.sf1s" +indexinfo[].command[].command "exact @mse4_value_sf1s@" +indexinfo[].command[].indexname "mse4.value.sf2i" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4.value.sf2i" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "mse4.value.sf2i" +indexinfo[].command[].command "numerical" +indexinfo[].command[].indexname "mse4.value.sf2i" +indexinfo[].command[].command "type int" +indexinfo[].command[].indexname "mse4.value" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4.value" +indexinfo[].command[].command "type elem" +indexinfo[].command[].indexname "mse4" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4" +indexinfo[].command[].command "multivalue" +indexinfo[].command[].indexname "mse4" +indexinfo[].command[].command "type Map<string,elem>" diff --git a/config-model/src/test/derived/matchsettings_map_after/test.sd b/config-model/src/test/derived/matchsettings_map_after/test.sd new file mode 100644 index 00000000000..2f6372628c9 --- /dev/null +++ b/config-model/src/test/derived/matchsettings_map_after/test.sd @@ -0,0 +1,34 @@ + +# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +search test { + document test { + + field mse4 type map<string,elem> { + indexing: summary + struct-field key { + indexing: index + match { + exact + exact-terminator: "@mse4_key@" + } + } + struct-field value.sf1s { + indexing: index + match { + exact + exact-terminator: "@mse4_value_sf1s@" + } + } + struct-field value.sf2i { + indexing: attribute + } + } + + struct elem { + field sf1s type string {} + field sf2i type int {} + } + + } +} diff --git a/config-model/src/test/derived/matchsettings_map_def/index-info.cfg b/config-model/src/test/derived/matchsettings_map_def/index-info.cfg new file mode 100644 index 00000000000..4e87847265a --- /dev/null +++ b/config-model/src/test/derived/matchsettings_map_def/index-info.cfg @@ -0,0 +1,105 @@ +indexinfo[].name "test" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "word" +indexinfo[].command[].indexname "mss3.key" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mss3.key" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "mss3.key" +indexinfo[].command[].command "stem:BEST" +indexinfo[].command[].indexname "mss3.key" +indexinfo[].command[].command "normalize" +indexinfo[].command[].indexname "mss3.key" +indexinfo[].command[].command "plain-tokens" +indexinfo[].command[].indexname "mss3.key" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mss3.value" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mss3.value" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "mss3.value" +indexinfo[].command[].command "stem:BEST" +indexinfo[].command[].indexname "mss3.value" +indexinfo[].command[].command "normalize" +indexinfo[].command[].indexname "mss3.value" +indexinfo[].command[].command "plain-tokens" +indexinfo[].command[].indexname "mss3.value" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mss3" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mss3" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "mss3" +indexinfo[].command[].command "multivalue" +indexinfo[].command[].indexname "mss3" +indexinfo[].command[].command "plain-tokens" +indexinfo[].command[].indexname "mss3" +indexinfo[].command[].command "type Map<string,string>" +indexinfo[].command[].indexname "mse4.key" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4.key" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mse4.value.sf1s" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4.value.sf1s" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mse4.value.sf2i" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4.value.sf2i" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "mse4.value.sf2i" +indexinfo[].command[].command "numerical" +indexinfo[].command[].indexname "mse4.value.sf2i" +indexinfo[].command[].command "type int" +indexinfo[].command[].indexname "mse4.value" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4.value" +indexinfo[].command[].command "type elem" +indexinfo[].command[].indexname "mse4" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4" +indexinfo[].command[].command "multivalue" +indexinfo[].command[].indexname "mse4" +indexinfo[].command[].command "type Map<string,elem>" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "fast-search" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "word" +indexinfo[].command[].indexname "mse5.value.sf1s" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse5.value.sf1s" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "mse5.value.sf1s" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "mse5.value.sf1s" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mse5.value.sf1s" +indexinfo[].command[].command "word" +indexinfo[].command[].indexname "mse5.value.sf2i" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse5.value.sf2i" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "mse5.value.sf2i" +indexinfo[].command[].command "numerical" +indexinfo[].command[].indexname "mse5.value.sf2i" +indexinfo[].command[].command "type int" +indexinfo[].command[].indexname "mse5.value" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse5.value" +indexinfo[].command[].command "type elem" +indexinfo[].command[].indexname "mse5" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse5" +indexinfo[].command[].command "multivalue" +indexinfo[].command[].indexname "mse5" +indexinfo[].command[].command "type Map<string,elem>" diff --git a/config-model/src/test/derived/matchsettings_map_def/test.sd b/config-model/src/test/derived/matchsettings_map_def/test.sd new file mode 100644 index 00000000000..7f2517c80fc --- /dev/null +++ b/config-model/src/test/derived/matchsettings_map_def/test.sd @@ -0,0 +1,50 @@ + +# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +search test { + document test { + + struct elem { + field sf1s type string {} + field sf2i type int {} + } + + field mss3 type map<string,string> { + indexing: index + struct-field key { + indexing: index + } + struct-field value { + indexing: index + } + } + + field mse4 type map<string,elem> { + indexing: summary + struct-field key { + indexing: index + } + struct-field value.sf1s { + indexing: index + } + struct-field value.sf2i { + indexing: attribute + } + } + + field mse5 type map<string,elem> { + indexing: summary + struct-field key { + indexing: attribute + attribute: fast-search + } + struct-field value.sf1s { + indexing: attribute + } + struct-field value.sf2i { + indexing: attribute + } + } + + } +} diff --git a/config-model/src/test/derived/matchsettings_map_wfs/index-info.cfg b/config-model/src/test/derived/matchsettings_map_wfs/index-info.cfg new file mode 100644 index 00000000000..38ae1f78d17 --- /dev/null +++ b/config-model/src/test/derived/matchsettings_map_wfs/index-info.cfg @@ -0,0 +1,101 @@ +indexinfo[].name "test" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "word" +indexinfo[].command[].indexname "mss3.key" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mss3.key" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "mss3.key" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mss3.key" +indexinfo[].command[].command "exact @mss3_key@" +indexinfo[].command[].indexname "mss3.value" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mss3.value" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "mss3.value" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mss3.value" +indexinfo[].command[].command "exact @mss3_value@" +indexinfo[].command[].indexname "mss3" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mss3" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "mss3" +indexinfo[].command[].command "multivalue" +indexinfo[].command[].indexname "mss3" +indexinfo[].command[].command "plain-tokens" +indexinfo[].command[].indexname "mss3" +indexinfo[].command[].command "type Map<string,string>" +indexinfo[].command[].indexname "mse4.key" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4.key" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mse4.key" +indexinfo[].command[].command "exact @mse4_key@" +indexinfo[].command[].indexname "mse4.value.sf1s" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4.value.sf1s" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mse4.value.sf1s" +indexinfo[].command[].command "exact @mse4_value_sf1s@" +indexinfo[].command[].indexname "mse4.value.sf2i" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4.value.sf2i" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "mse4.value.sf2i" +indexinfo[].command[].command "numerical" +indexinfo[].command[].indexname "mse4.value.sf2i" +indexinfo[].command[].command "type int" +indexinfo[].command[].indexname "mse4.value" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4.value" +indexinfo[].command[].command "type elem" +indexinfo[].command[].indexname "mse4" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4" +indexinfo[].command[].command "multivalue" +indexinfo[].command[].indexname "mse4" +indexinfo[].command[].command "type Map<string,elem>" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "fast-search" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "exact @mse5_key@" +indexinfo[].command[].indexname "mse5.value.sf1s" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse5.value.sf1s" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "mse5.value.sf1s" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "mse5.value.sf1s" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mse5.value.sf1s" +indexinfo[].command[].command "exact @mse5_value_sf1s@" +indexinfo[].command[].indexname "mse5.value.sf2i" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse5.value.sf2i" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "mse5.value.sf2i" +indexinfo[].command[].command "numerical" +indexinfo[].command[].indexname "mse5.value.sf2i" +indexinfo[].command[].command "type int" +indexinfo[].command[].indexname "mse5.value" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse5.value" +indexinfo[].command[].command "type elem" +indexinfo[].command[].indexname "mse5" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse5" +indexinfo[].command[].command "multivalue" +indexinfo[].command[].indexname "mse5" +indexinfo[].command[].command "type Map<string,elem>" diff --git a/config-model/src/test/derived/matchsettings_map_wfs/test.sd b/config-model/src/test/derived/matchsettings_map_wfs/test.sd new file mode 100644 index 00000000000..12c0c395282 --- /dev/null +++ b/config-model/src/test/derived/matchsettings_map_wfs/test.sd @@ -0,0 +1,72 @@ + +# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +search test { + document test { + + struct elem { + field sf1s type string {} + field sf2i type int {} + } + + field mss3 type map<string,string> { + indexing: index + struct-field key { + match { + exact + exact-terminator: "@mss3_key@" + } + } + struct-field value { + match { + exact + exact-terminator: "@mss3_value@" + } + } + } + + field mse4 type map<string,elem> { + indexing: summary + struct-field key { + indexing: index + match { + exact + exact-terminator: "@mse4_key@" + } + } + struct-field value.sf1s { + indexing: index + match { + exact + exact-terminator: "@mse4_value_sf1s@" + } + } + struct-field value.sf2i { + indexing: attribute + } + } + + field mse5 type map<string,elem> { + indexing: summary + struct-field key { + indexing: attribute + attribute: fast-search + match { + exact + exact-terminator: "@mse5_key@" + } + } + struct-field value.sf1s { + indexing: attribute + match { + exact + exact-terminator: "@mse5_value_sf1s@" + } + } + struct-field value.sf2i { + indexing: attribute + } + } + + } +} diff --git a/config-model/src/test/derived/matchsettings_map_wss/index-info.cfg b/config-model/src/test/derived/matchsettings_map_wss/index-info.cfg new file mode 100644 index 00000000000..0f6773d0fe8 --- /dev/null +++ b/config-model/src/test/derived/matchsettings_map_wss/index-info.cfg @@ -0,0 +1,107 @@ +indexinfo[].name "test" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "word" +indexinfo[].command[].indexname "mss3.key" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mss3.key" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "mss3.key" +indexinfo[].command[].command "stem:BEST" +indexinfo[].command[].indexname "mss3.key" +indexinfo[].command[].command "normalize" +indexinfo[].command[].indexname "mss3.key" +indexinfo[].command[].command "plain-tokens" +indexinfo[].command[].indexname "mss3.key" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mss3.value" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mss3.value" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "mss3.value" +indexinfo[].command[].command "stem:BEST" +indexinfo[].command[].indexname "mss3.value" +indexinfo[].command[].command "normalize" +indexinfo[].command[].indexname "mss3.value" +indexinfo[].command[].command "plain-tokens" +indexinfo[].command[].indexname "mss3.value" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mss3" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mss3" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "mss3" +indexinfo[].command[].command "multivalue" +indexinfo[].command[].indexname "mss3" +indexinfo[].command[].command "plain-tokens" +indexinfo[].command[].indexname "mss3" +indexinfo[].command[].command "type Map<string,string>" +indexinfo[].command[].indexname "mse4.key" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4.key" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mse4.value.sf1s" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4.value.sf1s" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mse4.value.sf1s" +indexinfo[].command[].command "exact @elem_sf1s@" +indexinfo[].command[].indexname "mse4.value.sf2i" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4.value.sf2i" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "mse4.value.sf2i" +indexinfo[].command[].command "numerical" +indexinfo[].command[].indexname "mse4.value.sf2i" +indexinfo[].command[].command "type int" +indexinfo[].command[].indexname "mse4.value" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4.value" +indexinfo[].command[].command "type elem" +indexinfo[].command[].indexname "mse4" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse4" +indexinfo[].command[].command "multivalue" +indexinfo[].command[].indexname "mse4" +indexinfo[].command[].command "type Map<string,elem>" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "fast-search" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mse5.key" +indexinfo[].command[].command "word" +indexinfo[].command[].indexname "mse5.value.sf1s" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse5.value.sf1s" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "mse5.value.sf1s" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "mse5.value.sf1s" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "mse5.value.sf1s" +indexinfo[].command[].command "exact @elem_sf1s@" +indexinfo[].command[].indexname "mse5.value.sf2i" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse5.value.sf2i" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "mse5.value.sf2i" +indexinfo[].command[].command "numerical" +indexinfo[].command[].indexname "mse5.value.sf2i" +indexinfo[].command[].command "type int" +indexinfo[].command[].indexname "mse5.value" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse5.value" +indexinfo[].command[].command "type elem" +indexinfo[].command[].indexname "mse5" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "mse5" +indexinfo[].command[].command "multivalue" +indexinfo[].command[].indexname "mse5" +indexinfo[].command[].command "type Map<string,elem>" diff --git a/config-model/src/test/derived/matchsettings_map_wss/test.sd b/config-model/src/test/derived/matchsettings_map_wss/test.sd new file mode 100644 index 00000000000..58162ea93fc --- /dev/null +++ b/config-model/src/test/derived/matchsettings_map_wss/test.sd @@ -0,0 +1,55 @@ + +# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +search test { + document test { + + struct elem { + field sf1s type string { + match { + exact + exact-terminator: "@elem_sf1s@" + } + } + field sf2i type int {} + } + + field mss3 type map<string,string> { + indexing: index + struct-field key { + indexing: index + } + struct-field value { + indexing: index + } + } + + field mse4 type map<string,elem> { + indexing: summary + struct-field key { + indexing: index + } + struct-field value.sf1s { + indexing: index + } + struct-field value.sf2i { + indexing: attribute + } + } + + field mse5 type map<string,elem> { + indexing: summary + struct-field key { + indexing: attribute + attribute: fast-search + } + struct-field value.sf1s { + indexing: attribute + } + struct-field value.sf2i { + indexing: attribute + } + } + + } +} diff --git a/config-model/src/test/derived/matchsettings_simple_def/index-info.cfg b/config-model/src/test/derived/matchsettings_simple_def/index-info.cfg new file mode 100644 index 00000000000..fbd7b7755cc --- /dev/null +++ b/config-model/src/test/derived/matchsettings_simple_def/index-info.cfg @@ -0,0 +1,33 @@ +indexinfo[].name "test" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "word" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "stem:BEST" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "normalize" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "plain-tokens" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "field_2_struct.elem_field_1_string" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "field_2_struct.elem_field_1_string" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "field_2_struct.elem_field_2_int" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "field_2_struct.elem_field_2_int" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "field_2_struct.elem_field_2_int" +indexinfo[].command[].command "numerical" +indexinfo[].command[].indexname "field_2_struct.elem_field_2_int" +indexinfo[].command[].command "type int" +indexinfo[].command[].indexname "field_2_struct" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "field_2_struct" +indexinfo[].command[].command "type elem" diff --git a/config-model/src/test/derived/matchsettings_simple_def/test.sd b/config-model/src/test/derived/matchsettings_simple_def/test.sd new file mode 100644 index 00000000000..8d5a1733a44 --- /dev/null +++ b/config-model/src/test/derived/matchsettings_simple_def/test.sd @@ -0,0 +1,27 @@ + +# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +search test { + document test { + + struct elem { + field elem_field_1_string type string {} + field elem_field_2_int type int {} + } + + field field_1_string type string { + indexing: index + } + + field field_2_struct type elem { + indexing: summary + struct-field elem_field_1_string { + indexing: index + } + struct-field elem_field_2_int { + indexing: attribute + } + } + + } +} diff --git a/config-model/src/test/derived/matchsettings_simple_wfs/index-info.cfg b/config-model/src/test/derived/matchsettings_simple_wfs/index-info.cfg new file mode 100644 index 00000000000..8362870f427 --- /dev/null +++ b/config-model/src/test/derived/matchsettings_simple_wfs/index-info.cfg @@ -0,0 +1,31 @@ +indexinfo[].name "test" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "word" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "exact @f1s@" +indexinfo[].command[].indexname "field_2_struct.elem_field_1_string" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "field_2_struct.elem_field_1_string" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "field_2_struct.elem_field_1_string" +indexinfo[].command[].command "exact @f2s@" +indexinfo[].command[].indexname "field_2_struct.elem_field_2_int" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "field_2_struct.elem_field_2_int" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "field_2_struct.elem_field_2_int" +indexinfo[].command[].command "numerical" +indexinfo[].command[].indexname "field_2_struct.elem_field_2_int" +indexinfo[].command[].command "type int" +indexinfo[].command[].indexname "field_2_struct" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "field_2_struct" +indexinfo[].command[].command "type elem" diff --git a/config-model/src/test/derived/matchsettings_simple_wfs/test.sd b/config-model/src/test/derived/matchsettings_simple_wfs/test.sd new file mode 100644 index 00000000000..9c709d8167e --- /dev/null +++ b/config-model/src/test/derived/matchsettings_simple_wfs/test.sd @@ -0,0 +1,35 @@ + +# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +search test { + document test { + + struct elem { + field elem_field_1_string type string {} + field elem_field_2_int type int {} + } + + field field_1_string type string { + indexing: index + match { + exact + exact-terminator: "@f1s@" + } + } + + field field_2_struct type elem { + indexing: summary + struct-field elem_field_1_string { + indexing: index + match { + exact + exact-terminator: "@f2s@" + } + } + struct-field elem_field_2_int { + indexing: attribute + } + } + + } +} diff --git a/config-model/src/test/derived/matchsettings_simple_wss/index-info.cfg b/config-model/src/test/derived/matchsettings_simple_wss/index-info.cfg new file mode 100644 index 00000000000..dda78b04f9b --- /dev/null +++ b/config-model/src/test/derived/matchsettings_simple_wss/index-info.cfg @@ -0,0 +1,31 @@ +indexinfo[].name "test" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "word" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "exact @f1s@" +indexinfo[].command[].indexname "field_2_struct.elem_field_1_string" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "field_2_struct.elem_field_1_string" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "field_2_struct.elem_field_1_string" +indexinfo[].command[].command "exact @ef1@" +indexinfo[].command[].indexname "field_2_struct.elem_field_2_int" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "field_2_struct.elem_field_2_int" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "field_2_struct.elem_field_2_int" +indexinfo[].command[].command "numerical" +indexinfo[].command[].indexname "field_2_struct.elem_field_2_int" +indexinfo[].command[].command "type int" +indexinfo[].command[].indexname "field_2_struct" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "field_2_struct" +indexinfo[].command[].command "type elem" diff --git a/config-model/src/test/derived/matchsettings_simple_wss/test.sd b/config-model/src/test/derived/matchsettings_simple_wss/test.sd new file mode 100644 index 00000000000..451d9ad06d8 --- /dev/null +++ b/config-model/src/test/derived/matchsettings_simple_wss/test.sd @@ -0,0 +1,36 @@ + +# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +search test { + document test { + + struct elem { + field elem_field_1_string type string { + match { + exact + exact-terminator: "@ef1@" + } + } + field elem_field_2_int type int {} + } + + field field_1_string type string { + indexing: index + match { + exact + exact-terminator: "@f1s@" + } + } + + field field_2_struct type elem { + indexing: summary + struct-field elem_field_1_string { + indexing: index + } + struct-field elem_field_2_int { + indexing: attribute + } + } + + } +} diff --git a/config-model/src/test/derived/matchsettings_simple_wss_wfs/index-info.cfg b/config-model/src/test/derived/matchsettings_simple_wss_wfs/index-info.cfg new file mode 100644 index 00000000000..8362870f427 --- /dev/null +++ b/config-model/src/test/derived/matchsettings_simple_wss_wfs/index-info.cfg @@ -0,0 +1,31 @@ +indexinfo[].name "test" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "word" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "field_1_string" +indexinfo[].command[].command "exact @f1s@" +indexinfo[].command[].indexname "field_2_struct.elem_field_1_string" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "field_2_struct.elem_field_1_string" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "field_2_struct.elem_field_1_string" +indexinfo[].command[].command "exact @f2s@" +indexinfo[].command[].indexname "field_2_struct.elem_field_2_int" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "field_2_struct.elem_field_2_int" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "field_2_struct.elem_field_2_int" +indexinfo[].command[].command "numerical" +indexinfo[].command[].indexname "field_2_struct.elem_field_2_int" +indexinfo[].command[].command "type int" +indexinfo[].command[].indexname "field_2_struct" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "field_2_struct" +indexinfo[].command[].command "type elem" diff --git a/config-model/src/test/derived/matchsettings_simple_wss_wfs/test.sd b/config-model/src/test/derived/matchsettings_simple_wss_wfs/test.sd new file mode 100644 index 00000000000..f3967e6ad80 --- /dev/null +++ b/config-model/src/test/derived/matchsettings_simple_wss_wfs/test.sd @@ -0,0 +1,40 @@ + +# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +search test { + document test { + + struct elem { + field elem_field_1_string type string { + match { + exact + exact-terminator: "@ef1@" + } + } + field elem_field_2_int type int {} + } + + field field_1_string type string { + indexing: index + match { + exact + exact-terminator: "@f1s@" + } + } + + field field_2_struct type elem { + indexing: summary + struct-field elem_field_1_string { + indexing: index + match { + exact + exact-terminator: "@f2s@" + } + } + struct-field elem_field_2_int { + indexing: attribute + } + } + + } +} diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/MatchSettingsResolvingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/MatchSettingsResolvingTestCase.java new file mode 100755 index 00000000000..63e3df2205f --- /dev/null +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/MatchSettingsResolvingTestCase.java @@ -0,0 +1,87 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.searchdefinition.derived; + +import com.yahoo.config.model.deploy.TestProperties; +import com.yahoo.searchdefinition.parser.ParseException; +import org.junit.Test; + +import java.io.IOException; + +/** + * @author arnej + */ +public class MatchSettingsResolvingTestCase extends AbstractExportingTestCase { + + @Test + public void testSimpleDefaults() throws IOException, ParseException { + assertCorrectDeriving("matchsettings_simple_def", + new TestProperties().setExperimentalSdParsing(false)); + assertCorrectDeriving("matchsettings_simple_def", + new TestProperties().setExperimentalSdParsing(true)); + } + + @Test + public void testSimpleWithStructSettings() throws IOException, ParseException { + assertCorrectDeriving("matchsettings_simple_wss", + new TestProperties().setExperimentalSdParsing(false)); + assertCorrectDeriving("matchsettings_simple_wss", + new TestProperties().setExperimentalSdParsing(true)); + } + + @Test + public void testSimpleWithFieldSettings() throws IOException, ParseException { + assertCorrectDeriving("matchsettings_simple_wfs", + new TestProperties().setExperimentalSdParsing(false)); + assertCorrectDeriving("matchsettings_simple_wfs", + new TestProperties().setExperimentalSdParsing(true)); + } + + @Test + public void testSimpleStructAndFieldSettings() throws IOException, ParseException { + assertCorrectDeriving("matchsettings_simple_wss_wfs", + new TestProperties().setExperimentalSdParsing(false)); + assertCorrectDeriving("matchsettings_simple_wss_wfs", + new TestProperties().setExperimentalSdParsing(true)); + } + + @Test + public void testMapDefaults() throws IOException, ParseException { + assertCorrectDeriving("matchsettings_map_def", + new TestProperties().setExperimentalSdParsing(false)); + assertCorrectDeriving("matchsettings_map_def", + new TestProperties().setExperimentalSdParsing(true)); + } + + @Test + public void testMapWithStructSettings() throws IOException, ParseException { + /* + * does not work + * does not pick up settings from struct declaration + assertCorrectDeriving("matchsettings_map_wss", + new TestProperties().setExperimentalSdParsing(false)); + */ + assertCorrectDeriving("matchsettings_map_wss", + new TestProperties().setExperimentalSdParsing(true)); + } + + @Test + public void testMapWithFieldSettings() throws IOException, ParseException { + assertCorrectDeriving("matchsettings_map_wfs", + new TestProperties().setExperimentalSdParsing(false)); + assertCorrectDeriving("matchsettings_map_wfs", + new TestProperties().setExperimentalSdParsing(true)); + } + + @Test + public void testMapAfter() throws IOException, ParseException { + /* fails with: + java.lang.IllegalArgumentException: Could not find struct 'elem'. + assertCorrectDeriving("matchsettings_map_after", + new TestProperties().setExperimentalSdParsing(false)); + */ + assertCorrectDeriving("matchsettings_map_after", + new TestProperties().setExperimentalSdParsing(true)); + } + + +} |