aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2020-01-08 08:28:12 +0000
committerGeir Storli <geirst@verizonmedia.com>2020-01-09 08:09:59 +0000
commitadf44e573d2d02cb3cb3740e17019976325dc76a (patch)
treeaf887d4ad71eb7aacb6b6f093722e53dbee05030 /config-model/src
parentfbea1c3b5a6020d6d5fbd5b76d1eb3e693152500 (diff)
Ensure that non-numerical struct field attributes get 'word' matching.
This makes the match setting similar to regular attributes.
Diffstat (limited to 'config-model/src')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/AttributesImplicitWord.java17
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/WordMatch.java21
-rw-r--r--config-model/src/test/derived/array_of_struct_attribute/index-info.cfg44
-rw-r--r--config-model/src/test/derived/imported_struct_fields/index-info.cfg8
-rw-r--r--config-model/src/test/derived/map_attribute/index-info.cfg70
-rw-r--r--config-model/src/test/derived/map_of_struct_attribute/index-info.cfg104
-rw-r--r--config-model/src/test/derived/streamingstruct/vsmfields.cfg8
7 files changed, 158 insertions, 114 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/AttributesImplicitWord.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/AttributesImplicitWord.java
index 55f101a4877..9b734cacede 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/AttributesImplicitWord.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/AttributesImplicitWord.java
@@ -25,9 +25,20 @@ public class AttributesImplicitWord extends Processor {
@Override
public void process(boolean validate, boolean documentsOnly) {
for (ImmutableSDField field : search.allConcreteFields()) {
- if (fieldImplicitlyWordMatch(field)) {
- field.getMatching().setType(Matching.Type.WORD);
- }
+ processFieldRecursive(field);
+ }
+ }
+
+ private void processFieldRecursive(ImmutableSDField field) {
+ processField(field);
+ for (ImmutableSDField structField : field.getStructFields()) {
+ processFieldRecursive(structField);
+ }
+ }
+
+ private void processField(ImmutableSDField field) {
+ if (fieldImplicitlyWordMatch(field)) {
+ field.getMatching().setType(Matching.Type.WORD);
}
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/WordMatch.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/WordMatch.java
index 13fe3f24d69..9338ff300ea 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/WordMatch.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/WordMatch.java
@@ -27,12 +27,25 @@ public class WordMatch extends Processor {
public void process(boolean validate, boolean documentsOnly) {
for (SDField field : search.allConcreteFields()) {
- if ( ! field.getMatching().getType().equals(Matching.Type.WORD)) continue;
+ processFieldRecursive(field);
+ }
+ }
+
+ private void processFieldRecursive(SDField field) {
+ processField(field);
+ for (SDField structField : field.getStructFields()) {
+ processField(structField);
+ }
+ }
- field.setStemming(Stemming.NONE);
- field.getNormalizing().inferLowercase();
- field.addQueryCommand("word");
+ private void processField(SDField field) {
+ if (!field.getMatching().getType().equals(Matching.Type.WORD)) {
+ return;
}
+ field.setStemming(Stemming.NONE);
+ field.getNormalizing().inferLowercase();
+ field.addQueryCommand("word");
}
+
}
diff --git a/config-model/src/test/derived/array_of_struct_attribute/index-info.cfg b/config-model/src/test/derived/array_of_struct_attribute/index-info.cfg
index 99942d83f91..ebe87df9852 100644
--- a/config-model/src/test/derived/array_of_struct_attribute/index-info.cfg
+++ b/config-model/src/test/derived/array_of_struct_attribute/index-info.cfg
@@ -1,21 +1,23 @@
-indexinfo[0].name "test"
-indexinfo[0].command[0].indexname "sddocname"
-indexinfo[0].command[0].command "index"
-indexinfo[0].command[1].indexname "sddocname"
-indexinfo[0].command[1].command "word"
-indexinfo[0].command[2].indexname "elem_array.name"
-indexinfo[0].command[2].command "index"
-indexinfo[0].command[3].indexname "elem_array.name"
-indexinfo[0].command[3].command "attribute"
-indexinfo[0].command[4].indexname "elem_array.name"
-indexinfo[0].command[4].command "fast-search"
-indexinfo[0].command[5].indexname "elem_array.weight"
-indexinfo[0].command[5].command "index"
-indexinfo[0].command[6].indexname "elem_array.weight"
-indexinfo[0].command[6].command "attribute"
-indexinfo[0].command[7].indexname "elem_array.weight"
-indexinfo[0].command[7].command "numerical"
-indexinfo[0].command[8].indexname "elem_array"
-indexinfo[0].command[8].command "index"
-indexinfo[0].command[9].indexname "elem_array"
-indexinfo[0].command[9].command "multivalue"
+indexinfo[].name "test"
+indexinfo[].command[].indexname "sddocname"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "sddocname"
+indexinfo[].command[].command "word"
+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 "fast-search"
+indexinfo[].command[].indexname "elem_array.name"
+indexinfo[].command[].command "word"
+indexinfo[].command[].indexname "elem_array.weight"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "elem_array.weight"
+indexinfo[].command[].command "attribute"
+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"
diff --git a/config-model/src/test/derived/imported_struct_fields/index-info.cfg b/config-model/src/test/derived/imported_struct_fields/index-info.cfg
index 3723b06fcbe..4aa54dac933 100644
--- a/config-model/src/test/derived/imported_struct_fields/index-info.cfg
+++ b/config-model/src/test/derived/imported_struct_fields/index-info.cfg
@@ -17,6 +17,8 @@ indexinfo[].command[].indexname "my_elem_array.name"
indexinfo[].command[].command "attribute"
indexinfo[].command[].indexname "my_elem_array.name"
indexinfo[].command[].command "fast-search"
+indexinfo[].command[].indexname "my_elem_array.name"
+indexinfo[].command[].command "word"
indexinfo[].command[].indexname "my_elem_array.weight"
indexinfo[].command[].command "index"
indexinfo[].command[].indexname "my_elem_array.weight"
@@ -33,6 +35,8 @@ indexinfo[].command[].indexname "my_elem_map.value.name"
indexinfo[].command[].command "attribute"
indexinfo[].command[].indexname "my_elem_map.value.name"
indexinfo[].command[].command "fast-search"
+indexinfo[].command[].indexname "my_elem_map.value.name"
+indexinfo[].command[].command "word"
indexinfo[].command[].indexname "my_elem_map.value.weight"
indexinfo[].command[].command "index"
indexinfo[].command[].indexname "my_elem_map.value.weight"
@@ -47,6 +51,8 @@ indexinfo[].command[].indexname "my_elem_map.key"
indexinfo[].command[].command "attribute"
indexinfo[].command[].indexname "my_elem_map.key"
indexinfo[].command[].command "fast-search"
+indexinfo[].command[].indexname "my_elem_map.key"
+indexinfo[].command[].command "word"
indexinfo[].command[].indexname "my_elem_map"
indexinfo[].command[].command "index"
indexinfo[].command[].indexname "my_elem_map"
@@ -57,6 +63,8 @@ indexinfo[].command[].indexname "my_str_int_map.key"
indexinfo[].command[].command "attribute"
indexinfo[].command[].indexname "my_str_int_map.key"
indexinfo[].command[].command "fast-search"
+indexinfo[].command[].indexname "my_str_int_map.key"
+indexinfo[].command[].command "word"
indexinfo[].command[].indexname "my_str_int_map.value"
indexinfo[].command[].command "index"
indexinfo[].command[].indexname "my_str_int_map.value"
diff --git a/config-model/src/test/derived/map_attribute/index-info.cfg b/config-model/src/test/derived/map_attribute/index-info.cfg
index 1d44648ef6f..67c6bbf4d1b 100644
--- a/config-model/src/test/derived/map_attribute/index-info.cfg
+++ b/config-model/src/test/derived/map_attribute/index-info.cfg
@@ -1,33 +1,37 @@
-indexinfo[0].name "test"
-indexinfo[0].command[0].indexname "sddocname"
-indexinfo[0].command[0].command "index"
-indexinfo[0].command[1].indexname "sddocname"
-indexinfo[0].command[1].command "word"
-indexinfo[0].command[2].indexname "str_map.key"
-indexinfo[0].command[2].command "index"
-indexinfo[0].command[3].indexname "str_map.key"
-indexinfo[0].command[3].command "attribute"
-indexinfo[0].command[4].indexname "str_map.key"
-indexinfo[0].command[4].command "fast-search"
-indexinfo[0].command[5].indexname "str_map.value"
-indexinfo[0].command[5].command "index"
-indexinfo[0].command[6].indexname "str_map.value"
-indexinfo[0].command[6].command "attribute"
-indexinfo[0].command[7].indexname "str_map"
-indexinfo[0].command[7].command "index"
-indexinfo[0].command[8].indexname "str_map"
-indexinfo[0].command[8].command "multivalue"
-indexinfo[0].command[9].indexname "int_map.key"
-indexinfo[0].command[9].command "index"
-indexinfo[0].command[10].indexname "int_map.key"
-indexinfo[0].command[10].command "attribute"
-indexinfo[0].command[11].indexname "int_map.key"
-indexinfo[0].command[11].command "numerical"
-indexinfo[0].command[12].indexname "int_map.value"
-indexinfo[0].command[12].command "index"
-indexinfo[0].command[13].indexname "int_map.value"
-indexinfo[0].command[13].command "numerical"
-indexinfo[0].command[14].indexname "int_map"
-indexinfo[0].command[14].command "index"
-indexinfo[0].command[15].indexname "int_map"
-indexinfo[0].command[15].command "multivalue"
+indexinfo[].name "test"
+indexinfo[].command[].indexname "sddocname"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "sddocname"
+indexinfo[].command[].command "word"
+indexinfo[].command[].indexname "str_map.key"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "str_map.key"
+indexinfo[].command[].command "attribute"
+indexinfo[].command[].indexname "str_map.key"
+indexinfo[].command[].command "fast-search"
+indexinfo[].command[].indexname "str_map.key"
+indexinfo[].command[].command "word"
+indexinfo[].command[].indexname "str_map.value"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "str_map.value"
+indexinfo[].command[].command "attribute"
+indexinfo[].command[].indexname "str_map.value"
+indexinfo[].command[].command "word"
+indexinfo[].command[].indexname "str_map"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "str_map"
+indexinfo[].command[].command "multivalue"
+indexinfo[].command[].indexname "int_map.key"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "int_map.key"
+indexinfo[].command[].command "attribute"
+indexinfo[].command[].indexname "int_map.key"
+indexinfo[].command[].command "numerical"
+indexinfo[].command[].indexname "int_map.value"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "int_map.value"
+indexinfo[].command[].command "numerical"
+indexinfo[].command[].indexname "int_map"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "int_map"
+indexinfo[].command[].command "multivalue"
diff --git a/config-model/src/test/derived/map_of_struct_attribute/index-info.cfg b/config-model/src/test/derived/map_of_struct_attribute/index-info.cfg
index 659bd86b9f0..84296b00a5d 100644
--- a/config-model/src/test/derived/map_of_struct_attribute/index-info.cfg
+++ b/config-model/src/test/derived/map_of_struct_attribute/index-info.cfg
@@ -1,49 +1,55 @@
-indexinfo[0].name "test"
-indexinfo[0].command[0].indexname "sddocname"
-indexinfo[0].command[0].command "index"
-indexinfo[0].command[1].indexname "sddocname"
-indexinfo[0].command[1].command "word"
-indexinfo[0].command[2].indexname "str_elem_map.key"
-indexinfo[0].command[2].command "index"
-indexinfo[0].command[3].indexname "str_elem_map.key"
-indexinfo[0].command[3].command "attribute"
-indexinfo[0].command[4].indexname "str_elem_map.key"
-indexinfo[0].command[4].command "fast-search"
-indexinfo[0].command[5].indexname "str_elem_map.value.name"
-indexinfo[0].command[5].command "index"
-indexinfo[0].command[6].indexname "str_elem_map.value.name"
-indexinfo[0].command[6].command "attribute"
-indexinfo[0].command[7].indexname "str_elem_map.value.weight"
-indexinfo[0].command[7].command "index"
-indexinfo[0].command[8].indexname "str_elem_map.value.weight"
-indexinfo[0].command[8].command "attribute"
-indexinfo[0].command[9].indexname "str_elem_map.value.weight"
-indexinfo[0].command[9].command "numerical"
-indexinfo[0].command[10].indexname "str_elem_map.value"
-indexinfo[0].command[10].command "index"
-indexinfo[0].command[11].indexname "str_elem_map"
-indexinfo[0].command[11].command "index"
-indexinfo[0].command[12].indexname "str_elem_map"
-indexinfo[0].command[12].command "multivalue"
-indexinfo[0].command[13].indexname "int_elem_map.key"
-indexinfo[0].command[13].command "index"
-indexinfo[0].command[14].indexname "int_elem_map.key"
-indexinfo[0].command[14].command "attribute"
-indexinfo[0].command[15].indexname "int_elem_map.key"
-indexinfo[0].command[15].command "numerical"
-indexinfo[0].command[16].indexname "int_elem_map.value.name"
-indexinfo[0].command[16].command "index"
-indexinfo[0].command[17].indexname "int_elem_map.value.name"
-indexinfo[0].command[17].command "attribute"
-indexinfo[0].command[18].indexname "int_elem_map.value.name"
-indexinfo[0].command[18].command "fast-search"
-indexinfo[0].command[19].indexname "int_elem_map.value.weight"
-indexinfo[0].command[19].command "index"
-indexinfo[0].command[20].indexname "int_elem_map.value.weight"
-indexinfo[0].command[20].command "numerical"
-indexinfo[0].command[21].indexname "int_elem_map.value"
-indexinfo[0].command[21].command "index"
-indexinfo[0].command[22].indexname "int_elem_map"
-indexinfo[0].command[22].command "index"
-indexinfo[0].command[23].indexname "int_elem_map"
-indexinfo[0].command[23].command "multivalue"
+indexinfo[].name "test"
+indexinfo[].command[].indexname "sddocname"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "sddocname"
+indexinfo[].command[].command "word"
+indexinfo[].command[].indexname "str_elem_map.key"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "str_elem_map.key"
+indexinfo[].command[].command "attribute"
+indexinfo[].command[].indexname "str_elem_map.key"
+indexinfo[].command[].command "fast-search"
+indexinfo[].command[].indexname "str_elem_map.key"
+indexinfo[].command[].command "word"
+indexinfo[].command[].indexname "str_elem_map.value.name"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "str_elem_map.value.name"
+indexinfo[].command[].command "attribute"
+indexinfo[].command[].indexname "str_elem_map.value.name"
+indexinfo[].command[].command "word"
+indexinfo[].command[].indexname "str_elem_map.value.weight"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "str_elem_map.value.weight"
+indexinfo[].command[].command "attribute"
+indexinfo[].command[].indexname "str_elem_map.value.weight"
+indexinfo[].command[].command "numerical"
+indexinfo[].command[].indexname "str_elem_map.value"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "str_elem_map"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "str_elem_map"
+indexinfo[].command[].command "multivalue"
+indexinfo[].command[].indexname "int_elem_map.key"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "int_elem_map.key"
+indexinfo[].command[].command "attribute"
+indexinfo[].command[].indexname "int_elem_map.key"
+indexinfo[].command[].command "numerical"
+indexinfo[].command[].indexname "int_elem_map.value.name"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "int_elem_map.value.name"
+indexinfo[].command[].command "attribute"
+indexinfo[].command[].indexname "int_elem_map.value.name"
+indexinfo[].command[].command "fast-search"
+indexinfo[].command[].indexname "int_elem_map.value.name"
+indexinfo[].command[].command "word"
+indexinfo[].command[].indexname "int_elem_map.value.weight"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "int_elem_map.value.weight"
+indexinfo[].command[].command "numerical"
+indexinfo[].command[].indexname "int_elem_map.value"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "int_elem_map"
+indexinfo[].command[].command "index"
+indexinfo[].command[].indexname "int_elem_map"
+indexinfo[].command[].command "multivalue"
diff --git a/config-model/src/test/derived/streamingstruct/vsmfields.cfg b/config-model/src/test/derived/streamingstruct/vsmfields.cfg
index a99a704be3a..7178f9d41ea 100644
--- a/config-model/src/test/derived/streamingstruct/vsmfields.cfg
+++ b/config-model/src/test/derived/streamingstruct/vsmfields.cfg
@@ -62,7 +62,7 @@ fieldspec[].maxlength 1048576
fieldspec[].fieldtype INDEX
fieldspec[].name "c.f1"
fieldspec[].searchmethod AUTOUTF8
-fieldspec[].arg1 ""
+fieldspec[].arg1 "word"
fieldspec[].maxlength 1048576
fieldspec[].fieldtype ATTRIBUTE
fieldspec[].name "c.f1s"
@@ -77,7 +77,7 @@ fieldspec[].maxlength 1048576
fieldspec[].fieldtype INDEX
fieldspec[].name "c2.f1"
fieldspec[].searchmethod AUTOUTF8
-fieldspec[].arg1 ""
+fieldspec[].arg1 "word"
fieldspec[].maxlength 1048576
fieldspec[].fieldtype ATTRIBUTE
fieldspec[].name "c2.f1s"
@@ -97,7 +97,7 @@ fieldspec[].maxlength 1048576
fieldspec[].fieldtype INDEX
fieldspec[].name "c3.f1"
fieldspec[].searchmethod AUTOUTF8
-fieldspec[].arg1 ""
+fieldspec[].arg1 "word"
fieldspec[].maxlength 1048576
fieldspec[].fieldtype ATTRIBUTE
fieldspec[].name "c3.f1s"
@@ -197,7 +197,7 @@ fieldspec[].maxlength 1048576
fieldspec[].fieldtype INDEX
fieldspec[].name "array3.f1"
fieldspec[].searchmethod AUTOUTF8
-fieldspec[].arg1 ""
+fieldspec[].arg1 "word"
fieldspec[].maxlength 1048576
fieldspec[].fieldtype ATTRIBUTE
fieldspec[].name "array3.f1s"