From e10e86fd2dbfb9a38c71e82a84ac10fed31bac3d Mon Sep 17 00:00:00 2001 From: Arne H Juul Date: Mon, 13 Dec 2021 10:00:31 +0000 Subject: try harder to get multi-level inheritance working --- .../src/test/derived/inheritstruct/child.sd | 13 ++++ .../src/test/derived/inheritstruct/index-info.cfg | 76 +++++++++++++++------- .../derived/structinheritance/documentmanager.cfg | 40 ++++++++---- .../derived/structinheritance/documenttypes.cfg | 70 ++++++++++++++------ .../src/test/derived/structinheritance/simple.sd | 6 +- 5 files changed, 148 insertions(+), 57 deletions(-) (limited to 'config-model/src/test/derived') diff --git a/config-model/src/test/derived/inheritstruct/child.sd b/config-model/src/test/derived/inheritstruct/child.sd index 0ac4048e5fa..fcc3cececc3 100644 --- a/config-model/src/test/derived/inheritstruct/child.sd +++ b/config-model/src/test/derived/inheritstruct/child.sd @@ -1,9 +1,22 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. search child { document child inherits parent { + struct other_struct inherits my_struct { + field my_int type int {} + } + struct wrapper { + field wrapped type my_struct {} + } + field child_struct_field type my_struct { indexing: summary | index match: prefix } + field other_field type other_struct { + indexing: summary + } + field wrapped_field type wrapper { + indexing: summary + } } } diff --git a/config-model/src/test/derived/inheritstruct/index-info.cfg b/config-model/src/test/derived/inheritstruct/index-info.cfg index 21e68f0c127..5afa91ea1bb 100644 --- a/config-model/src/test/derived/inheritstruct/index-info.cfg +++ b/config-model/src/test/derived/inheritstruct/index-info.cfg @@ -1,25 +1,51 @@ -indexinfo[].name "child" -indexinfo[].command[].indexname "sddocname" -indexinfo[].command[].command "index" -indexinfo[].command[].indexname "sddocname" -indexinfo[].command[].command "word" -indexinfo[].command[].indexname "child_struct_field.my_str" -indexinfo[].command[].command "index" -indexinfo[].command[].indexname "child_struct_field.my_str" -indexinfo[].command[].command "lowercase" -indexinfo[].command[].indexname "child_struct_field.my_str" -indexinfo[].command[].command "stem:BEST" -indexinfo[].command[].indexname "child_struct_field.my_str" -indexinfo[].command[].command "normalize" -indexinfo[].command[].indexname "child_struct_field.my_str" -indexinfo[].command[].command "plain-tokens" -indexinfo[].command[].indexname "child_struct_field.my_str" -indexinfo[].command[].command "type string" -indexinfo[].command[].indexname "child_struct_field" -indexinfo[].command[].command "index" -indexinfo[].command[].indexname "child_struct_field" -indexinfo[].command[].command "lowercase" -indexinfo[].command[].indexname "child_struct_field" -indexinfo[].command[].command "plain-tokens" -indexinfo[].command[].indexname "child_struct_field" -indexinfo[].command[].command "type my_struct" +indexinfo[0].name "child" +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 "child_struct_field.my_str" +indexinfo[0].command[2].command "index" +indexinfo[0].command[3].indexname "child_struct_field.my_str" +indexinfo[0].command[3].command "lowercase" +indexinfo[0].command[4].indexname "child_struct_field.my_str" +indexinfo[0].command[4].command "stem:BEST" +indexinfo[0].command[5].indexname "child_struct_field.my_str" +indexinfo[0].command[5].command "normalize" +indexinfo[0].command[6].indexname "child_struct_field.my_str" +indexinfo[0].command[6].command "plain-tokens" +indexinfo[0].command[7].indexname "child_struct_field.my_str" +indexinfo[0].command[7].command "type string" +indexinfo[0].command[8].indexname "child_struct_field" +indexinfo[0].command[8].command "index" +indexinfo[0].command[9].indexname "child_struct_field" +indexinfo[0].command[9].command "lowercase" +indexinfo[0].command[10].indexname "child_struct_field" +indexinfo[0].command[10].command "plain-tokens" +indexinfo[0].command[11].indexname "child_struct_field" +indexinfo[0].command[11].command "type my_struct" +indexinfo[0].command[12].indexname "other_field.my_str" +indexinfo[0].command[12].command "index" +indexinfo[0].command[13].indexname "other_field.my_str" +indexinfo[0].command[13].command "type string" +indexinfo[0].command[14].indexname "other_field.my_int" +indexinfo[0].command[14].command "index" +indexinfo[0].command[15].indexname "other_field.my_int" +indexinfo[0].command[15].command "numerical" +indexinfo[0].command[16].indexname "other_field.my_int" +indexinfo[0].command[16].command "type int" +indexinfo[0].command[17].indexname "other_field" +indexinfo[0].command[17].command "index" +indexinfo[0].command[18].indexname "other_field" +indexinfo[0].command[18].command "type other_struct" +indexinfo[0].command[19].indexname "wrapped_field.wrapped.my_str" +indexinfo[0].command[19].command "index" +indexinfo[0].command[20].indexname "wrapped_field.wrapped.my_str" +indexinfo[0].command[20].command "type string" +indexinfo[0].command[21].indexname "wrapped_field.wrapped" +indexinfo[0].command[21].command "index" +indexinfo[0].command[22].indexname "wrapped_field.wrapped" +indexinfo[0].command[22].command "type my_struct" +indexinfo[0].command[23].indexname "wrapped_field" +indexinfo[0].command[23].command "index" +indexinfo[0].command[24].indexname "wrapped_field" +indexinfo[0].command[24].command "type wrapper" \ No newline at end of file diff --git a/config-model/src/test/derived/structinheritance/documentmanager.cfg b/config-model/src/test/derived/structinheritance/documentmanager.cfg index 2f59cef4bcc..20994bacca2 100644 --- a/config-model/src/test/derived/structinheritance/documentmanager.cfg +++ b/config-model/src/test/derived/structinheritance/documentmanager.cfg @@ -35,21 +35,37 @@ datatype[2].structtype[0].field[0].datatype 0 datatype[2].structtype[0].field[0].detailedtype "" datatype[2].structtype[0].inherits[0].name "base" datatype[2].structtype[0].inherits[0].version 0 -datatype[3].id -2142109237 -datatype[3].structtype[0].name "simple.header" +datatype[3].id 1811766610 +datatype[3].structtype[0].name "grandchild" datatype[3].structtype[0].version 0 datatype[3].structtype[0].compresstype NONE datatype[3].structtype[0].compresslevel 0 datatype[3].structtype[0].compressthreshold 95 datatype[3].structtype[0].compressminsize 800 -datatype[3].structtype[0].field[0].name "f" -datatype[3].structtype[0].field[0].datatype 746267614 +datatype[3].structtype[0].field[0].name "toy" +datatype[3].structtype[0].field[0].datatype 2 datatype[3].structtype[0].field[0].detailedtype "" -datatype[4].id 485659380 -datatype[4].documenttype[0].name "simple" -datatype[4].documenttype[0].version 0 -datatype[4].documenttype[0].inherits[0].name "document" -datatype[4].documenttype[0].inherits[0].version 0 -datatype[4].documenttype[0].headerstruct -2142109237 -datatype[4].documenttype[0].bodystruct 0 -datatype[4].documenttype[0].fieldsets{[document]}.fields[0] "f" +datatype[3].structtype[0].inherits[0].name "child" +datatype[3].structtype[0].inherits[0].version 0 +datatype[4].id -2142109237 +datatype[4].structtype[0].name "simple.header" +datatype[4].structtype[0].version 0 +datatype[4].structtype[0].compresstype NONE +datatype[4].structtype[0].compresslevel 0 +datatype[4].structtype[0].compressthreshold 95 +datatype[4].structtype[0].compressminsize 800 +datatype[4].structtype[0].field[0].name "f1" +datatype[4].structtype[0].field[0].datatype 746267614 +datatype[4].structtype[0].field[0].detailedtype "" +datatype[4].structtype[0].field[1].name "f2" +datatype[4].structtype[0].field[1].datatype 1811766610 +datatype[4].structtype[0].field[1].detailedtype "" +datatype[5].id 485659380 +datatype[5].documenttype[0].name "simple" +datatype[5].documenttype[0].version 0 +datatype[5].documenttype[0].inherits[0].name "document" +datatype[5].documenttype[0].inherits[0].version 0 +datatype[5].documenttype[0].headerstruct -2142109237 +datatype[5].documenttype[0].bodystruct 0 +datatype[5].documenttype[0].fieldsets{[document]}.fields[0] "f1" +datatype[5].documenttype[0].fieldsets{[document]}.fields[1] "f2" diff --git a/config-model/src/test/derived/structinheritance/documenttypes.cfg b/config-model/src/test/derived/structinheritance/documenttypes.cfg index 64e7edd474b..52a154905c2 100644 --- a/config-model/src/test/derived/structinheritance/documenttypes.cfg +++ b/config-model/src/test/derived/structinheritance/documenttypes.cfg @@ -6,7 +6,7 @@ documenttype[0].version 0 documenttype[0].headerstruct -2142109237 documenttype[0].bodystruct 0 documenttype[0].inherits[0].id 8 -documenttype[0].datatype[0].id -1396204461 +documenttype[0].datatype[0].id 1811766610 documenttype[0].datatype[0].type STRUCT documenttype[0].datatype[0].array.element.id 0 documenttype[0].datatype[0].map.key.id 0 @@ -15,17 +15,25 @@ documenttype[0].datatype[0].wset.key.id 0 documenttype[0].datatype[0].wset.createifnonexistent false documenttype[0].datatype[0].wset.removeifzero false documenttype[0].datatype[0].annotationref.annotation.id 0 -documenttype[0].datatype[0].sstruct.name "base" +documenttype[0].datatype[0].sstruct.name "grandchild" documenttype[0].datatype[0].sstruct.version 0 documenttype[0].datatype[0].sstruct.compression.type NONE documenttype[0].datatype[0].sstruct.compression.level 0 documenttype[0].datatype[0].sstruct.compression.threshold 95 documenttype[0].datatype[0].sstruct.compression.minsize 200 -documenttype[0].datatype[0].sstruct.field[0].name "name" -documenttype[0].datatype[0].sstruct.field[0].id 1160796772 +documenttype[0].datatype[0].sstruct.field[0].name "toy" +documenttype[0].datatype[0].sstruct.field[0].id 536645790 documenttype[0].datatype[0].sstruct.field[0].datatype 2 documenttype[0].datatype[0].sstruct.field[0].detailedtype "" -documenttype[0].datatype[1].id 746267614 +documenttype[0].datatype[0].sstruct.field[1].name "age" +documenttype[0].datatype[0].sstruct.field[1].id 1862473705 +documenttype[0].datatype[0].sstruct.field[1].datatype 0 +documenttype[0].datatype[0].sstruct.field[1].detailedtype "" +documenttype[0].datatype[0].sstruct.field[2].name "name" +documenttype[0].datatype[0].sstruct.field[2].id 1160796772 +documenttype[0].datatype[0].sstruct.field[2].datatype 2 +documenttype[0].datatype[0].sstruct.field[2].detailedtype "" +documenttype[0].datatype[1].id -1396204461 documenttype[0].datatype[1].type STRUCT documenttype[0].datatype[1].array.element.id 0 documenttype[0].datatype[1].map.key.id 0 @@ -34,21 +42,17 @@ documenttype[0].datatype[1].wset.key.id 0 documenttype[0].datatype[1].wset.createifnonexistent false documenttype[0].datatype[1].wset.removeifzero false documenttype[0].datatype[1].annotationref.annotation.id 0 -documenttype[0].datatype[1].sstruct.name "child" +documenttype[0].datatype[1].sstruct.name "base" documenttype[0].datatype[1].sstruct.version 0 documenttype[0].datatype[1].sstruct.compression.type NONE documenttype[0].datatype[1].sstruct.compression.level 0 documenttype[0].datatype[1].sstruct.compression.threshold 95 documenttype[0].datatype[1].sstruct.compression.minsize 200 -documenttype[0].datatype[1].sstruct.field[0].name "age" -documenttype[0].datatype[1].sstruct.field[0].id 1862473705 -documenttype[0].datatype[1].sstruct.field[0].datatype 0 +documenttype[0].datatype[1].sstruct.field[0].name "name" +documenttype[0].datatype[1].sstruct.field[0].id 1160796772 +documenttype[0].datatype[1].sstruct.field[0].datatype 2 documenttype[0].datatype[1].sstruct.field[0].detailedtype "" -documenttype[0].datatype[1].sstruct.field[1].name "name" -documenttype[0].datatype[1].sstruct.field[1].id 1160796772 -documenttype[0].datatype[1].sstruct.field[1].datatype 2 -documenttype[0].datatype[1].sstruct.field[1].detailedtype "" -documenttype[0].datatype[2].id -2142109237 +documenttype[0].datatype[2].id 746267614 documenttype[0].datatype[2].type STRUCT documenttype[0].datatype[2].array.element.id 0 documenttype[0].datatype[2].map.key.id 0 @@ -57,14 +61,42 @@ documenttype[0].datatype[2].wset.key.id 0 documenttype[0].datatype[2].wset.createifnonexistent false documenttype[0].datatype[2].wset.removeifzero false documenttype[0].datatype[2].annotationref.annotation.id 0 -documenttype[0].datatype[2].sstruct.name "simple.header" +documenttype[0].datatype[2].sstruct.name "child" documenttype[0].datatype[2].sstruct.version 0 documenttype[0].datatype[2].sstruct.compression.type NONE documenttype[0].datatype[2].sstruct.compression.level 0 documenttype[0].datatype[2].sstruct.compression.threshold 95 documenttype[0].datatype[2].sstruct.compression.minsize 200 -documenttype[0].datatype[2].sstruct.field[0].name "f" -documenttype[0].datatype[2].sstruct.field[0].id 1257344291 -documenttype[0].datatype[2].sstruct.field[0].datatype 746267614 +documenttype[0].datatype[2].sstruct.field[0].name "age" +documenttype[0].datatype[2].sstruct.field[0].id 1862473705 +documenttype[0].datatype[2].sstruct.field[0].datatype 0 documenttype[0].datatype[2].sstruct.field[0].detailedtype "" -documenttype[0].fieldsets{[document]}.fields[0] "f" +documenttype[0].datatype[2].sstruct.field[1].name "name" +documenttype[0].datatype[2].sstruct.field[1].id 1160796772 +documenttype[0].datatype[2].sstruct.field[1].datatype 2 +documenttype[0].datatype[2].sstruct.field[1].detailedtype "" +documenttype[0].datatype[3].id -2142109237 +documenttype[0].datatype[3].type STRUCT +documenttype[0].datatype[3].array.element.id 0 +documenttype[0].datatype[3].map.key.id 0 +documenttype[0].datatype[3].map.value.id 0 +documenttype[0].datatype[3].wset.key.id 0 +documenttype[0].datatype[3].wset.createifnonexistent false +documenttype[0].datatype[3].wset.removeifzero false +documenttype[0].datatype[3].annotationref.annotation.id 0 +documenttype[0].datatype[3].sstruct.name "simple.header" +documenttype[0].datatype[3].sstruct.version 0 +documenttype[0].datatype[3].sstruct.compression.type NONE +documenttype[0].datatype[3].sstruct.compression.level 0 +documenttype[0].datatype[3].sstruct.compression.threshold 95 +documenttype[0].datatype[3].sstruct.compression.minsize 200 +documenttype[0].datatype[3].sstruct.field[0].name "f1" +documenttype[0].datatype[3].sstruct.field[0].id 750623154 +documenttype[0].datatype[3].sstruct.field[0].datatype 746267614 +documenttype[0].datatype[3].sstruct.field[0].detailedtype "" +documenttype[0].datatype[3].sstruct.field[1].name "f2" +documenttype[0].datatype[3].sstruct.field[1].id 1523850983 +documenttype[0].datatype[3].sstruct.field[1].datatype 1811766610 +documenttype[0].datatype[3].sstruct.field[1].detailedtype "" +documenttype[0].fieldsets{[document]}.fields[0] "f1" +documenttype[0].fieldsets{[document]}.fields[1] "f2" diff --git a/config-model/src/test/derived/structinheritance/simple.sd b/config-model/src/test/derived/structinheritance/simple.sd index 53a8e259af8..8b4bb6150c1 100644 --- a/config-model/src/test/derived/structinheritance/simple.sd +++ b/config-model/src/test/derived/structinheritance/simple.sd @@ -8,6 +8,10 @@ search simple { struct child inherits base { field age type int {} } - field f type child {} + struct grandchild inherits child { + field toy type string {} + } + field f1 type child {} + field f2 type grandchild {} } } -- cgit v1.2.3