summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2019-07-03 16:09:38 +0200
committerGitHub <noreply@github.com>2019-07-03 16:09:38 +0200
commit0a0f2cc1692fc9419accae1570d885a186380e3d (patch)
tree919b5b72bb25243e24c5a84bc9570b97aa96dcb2
parentead6d2f4a592be23e790740a4a1d41bb42eef65b (diff)
parentdd173feacaea1465c1886b229eb4335507c2b2ee (diff)
Merge pull request #9949 from vespa-engine/geirst/exact-match-for-struct-field-attributes
Fix such that exact match works for struct field attributes.
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/ExactMatch.java19
-rw-r--r--config-model/src/test/derived/exactmatch/exactmatch.sd31
-rw-r--r--config-model/src/test/derived/exactmatch/ilscripts.cfg6
-rw-r--r--config-model/src/test/derived/exactmatch/index-info.cfg44
4 files changed, 94 insertions, 6 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/ExactMatch.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/ExactMatch.java
index a7c0ebd4a07..a871da20669 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/ExactMatch.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/ExactMatch.java
@@ -28,12 +28,19 @@ public class ExactMatch extends Processor {
@Override
public void process(boolean validate, boolean documentsOnly) {
for (SDField field : search.allConcreteFields()) {
- Matching.Type matching = field.getMatching().getType();
- if (matching.equals(Matching.Type.EXACT) || matching.equals(Matching.Type.WORD)) {
- implementExactMatch(field, search);
- } else if (field.getMatching().getExactMatchTerminator() != null) {
- warn(search, field, "exact-terminator requires 'exact' matching to have any effect.");
- }
+ processField(field, search);
+ }
+ }
+
+ private void processField(SDField field, Search search) {
+ Matching.Type matching = field.getMatching().getType();
+ if (matching.equals(Matching.Type.EXACT) || matching.equals(Matching.Type.WORD)) {
+ implementExactMatch(field, search);
+ } else if (field.getMatching().getExactMatchTerminator() != null) {
+ warn(search, field, "exact-terminator requires 'exact' matching to have any effect.");
+ }
+ for (var structField : field.getStructFields()) {
+ processField(structField, search);
}
}
diff --git a/config-model/src/test/derived/exactmatch/exactmatch.sd b/config-model/src/test/derived/exactmatch/exactmatch.sd
index d5104fbf36d..2f1d54c970a 100644
--- a/config-model/src/test/derived/exactmatch/exactmatch.sd
+++ b/config-model/src/test/derived/exactmatch/exactmatch.sd
@@ -3,6 +3,11 @@ search exactmatch {
document exactmatch {
+ struct elem {
+ field name type string {}
+ field weight type int {}
+ }
+
field tag type string {
indexing: summary | index
match: exact
@@ -16,6 +21,32 @@ search exactmatch {
}
}
+ field string_map type map<string, string> {
+ indexing: summary
+ struct-field key {
+ indexing: attribute
+ match {
+ exact
+ exact-terminator: "*!!!*"
+ }
+ }
+ }
+
+ field elem_map type map<string, elem> {
+ indexing: summary
+ struct-field value.name {
+ indexing: attribute
+ match: exact
+ }
+ }
+
+ field elem_array type array<elem> {
+ indexing: summary
+ struct-field name {
+ indexing: attribute
+ match: exact
+ }
+ }
}
}
diff --git a/config-model/src/test/derived/exactmatch/ilscripts.cfg b/config-model/src/test/derived/exactmatch/ilscripts.cfg
index 38c0978474f..5595f954c4a 100644
--- a/config-model/src/test/derived/exactmatch/ilscripts.cfg
+++ b/config-model/src/test/derived/exactmatch/ilscripts.cfg
@@ -3,5 +3,11 @@ fieldmatchmaxlength 1000000
ilscript[].doctype "exactmatch"
ilscript[].docfield[] "tag"
ilscript[].docfield[] "screweduserids"
+ilscript[].docfield[] "string_map"
+ilscript[].docfield[] "elem_map"
+ilscript[].docfield[] "elem_array"
ilscript[].content[] "clear_state | guard { input tag | exact | summary tag | index tag; }"
ilscript[].content[] "clear_state | guard { input screweduserids | exact | index screweduserids | summary screweduserids | attribute screweduserids; }"
+ilscript[].content[] "input elem_array | passthrough elem_array"
+ilscript[].content[] "input elem_map | passthrough elem_map"
+ilscript[].content[] "input string_map | passthrough string_map"
diff --git a/config-model/src/test/derived/exactmatch/index-info.cfg b/config-model/src/test/derived/exactmatch/index-info.cfg
index a17ff68642e..a4a193b1fcd 100644
--- a/config-model/src/test/derived/exactmatch/index-info.cfg
+++ b/config-model/src/test/derived/exactmatch/index-info.cfg
@@ -15,3 +15,47 @@ indexinfo[].command[].indexname "screweduserids"
indexinfo[].command[].command "lowercase"
indexinfo[].command[].indexname "screweduserids"
indexinfo[].command[].command "exact *!!!*"
+indexinfo[].command[].indexname "string_map.key"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "string_map.key"
+indexinfo[].command[].command "attribute"
+indexinfo[].command[].indexname "string_map.key"
+indexinfo[].command[].command "exact *!!!*"
+indexinfo[].command[].indexname "string_map.value"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "string_map"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "string_map"
+indexinfo[].command[].command "multivalue"
+indexinfo[].command[].indexname "elem_map.key"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "elem_map.value.name"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "elem_map.value.name"
+indexinfo[].command[].command "attribute"
+indexinfo[].command[].indexname "elem_map.value.name"
+indexinfo[].command[].command "exact @@"
+indexinfo[].command[].indexname "elem_map.value.weight"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "elem_map.value.weight"
+indexinfo[].command[].command "numerical"
+indexinfo[].command[].indexname "elem_map.value"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "elem_map"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "elem_map"
+indexinfo[].command[].command "multivalue"
+indexinfo[].command[].indexname "elem_array.name"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "elem_array.name"
+indexinfo[].command[].command "attribute"
+indexinfo[].command[].indexname "elem_array.name"
+indexinfo[].command[].command "exact @@"
+indexinfo[].command[].indexname "elem_array.weight"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "elem_array.weight"
+indexinfo[].command[].command "numerical"
+indexinfo[].command[].indexname "elem_array"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "elem_array"
+indexinfo[].command[].command "multivalue"