diff options
author | Jon Bratseth <bratseth@gmail.com> | 2021-10-20 12:22:21 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2021-10-20 12:22:21 +0200 |
commit | 8f27baa4aba7ec98e39db5f701bf652e42faefa6 (patch) | |
tree | 9bd32a98be03bab55a8f111437db1611bfc75748 | |
parent | 8d337646d3f06b6ad987e4b3a8d7fda230726d00 (diff) |
Prep for test of deriving with schema inheritance
18 files changed, 512 insertions, 6 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java b/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java index b3da8ca14b9..1ef5dcef411 100644 --- a/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java +++ b/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java @@ -96,7 +96,7 @@ public class MockApplicationPackage implements ApplicationPackage { protected File root() { return root; } @Override - @SuppressWarnings("deprecation") + @SuppressWarnings("deprecation") // NOT redundant public String getApplicationName() { return "mock application"; } @@ -206,6 +206,15 @@ public class MockApplicationPackage implements ApplicationPackage { .withSchemaDir(dir).build(); } + // TODO: It might work to just merge this and the above + public static ApplicationPackage fromSearchDefinitionAndRootDirectory(String dir) { + return new MockApplicationPackage.Builder() + .withRoot(new File(dir)) + .withEmptyHosts() + .withEmptyServices() + .withSchemaDir(dir).build(); + } + public static class Builder { private File root = new File("nonexisting"); diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/SearchBuilder.java b/config-model/src/main/java/com/yahoo/searchdefinition/SearchBuilder.java index ff5d6d98c1c..dc5ab752f31 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/SearchBuilder.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/SearchBuilder.java @@ -418,6 +418,7 @@ public class SearchBuilder { return builder; } + public static SearchBuilder createFromDirectory(String dir, FileRegistry fileRegistry, DeployLogger logger, ModelContext.Properties properties) throws IOException, ParseException { return createFromDirectory(dir, fileRegistry, logger, properties, new RankProfileRegistry()); } @@ -434,7 +435,8 @@ public class SearchBuilder { ModelContext.Properties properties, RankProfileRegistry rankProfileRegistry, QueryProfileRegistry queryProfileRegistry) throws IOException, ParseException { - return createFromDirectory(dir, MockApplicationPackage.fromSearchDefinitionDirectory(dir), fileRegistry, logger, properties, rankProfileRegistry, queryProfileRegistry); + return createFromDirectory(dir, MockApplicationPackage.fromSearchDefinitionAndRootDirectory(dir), fileRegistry, logger, properties, + rankProfileRegistry, queryProfileRegistry); } private static SearchBuilder createFromDirectory(String dir, diff --git a/config-model/src/main/java/com/yahoo/vespa/model/ml/OnnxModelInfo.java b/config-model/src/main/java/com/yahoo/vespa/model/ml/OnnxModelInfo.java index f0309cc630b..88139de7888 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/ml/OnnxModelInfo.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/ml/OnnxModelInfo.java @@ -107,7 +107,7 @@ public class OnnxModelInfo { unboundSizes.add(size); if (unboundSizes.size() > 1) { throw new IllegalArgumentException("Found conflicting sizes for unbound dimension " + - "for type '" + onnxType + "'"); + "for type '" + onnxType + "'"); } // Handle dimensions with symbolic names @@ -115,7 +115,7 @@ public class OnnxModelInfo { String symbolicName = onnxType.dimensions().get(i).getSymbolicName(); if (symbolicSizes.containsKey(symbolicName) && ! symbolicSizes.get(symbolicName).equals(size)) { throw new IllegalArgumentException("Found conflicting sizes for symbolic dimension '" + - symbolicName + "' for input '" + onnxName + "'"); + symbolicName + "' for input '" + onnxName + "'"); } symbolicSizes.put(symbolicName, size); } @@ -131,7 +131,7 @@ public class OnnxModelInfo { if (app.getFile(generatedModelInfoPath(pathInApplicationPackage)).exists()) { return loadFromGeneratedInfo(pathInApplicationPackage, app); } - throw new IllegalArgumentException("Unable to find ONNX model file or generated ONNX info file"); + throw new IllegalArgumentException("Unable to find ONNX model '" + path + "'"); } static public boolean modelExists(String path, ApplicationPackage app) { diff --git a/config-model/src/test/derived/schemainheritance/attributes.cfg b/config-model/src/test/derived/schemainheritance/attributes.cfg new file mode 100644 index 00000000000..e0fbc0d49b2 --- /dev/null +++ b/config-model/src/test/derived/schemainheritance/attributes.cfg @@ -0,0 +1,124 @@ +attribute[].name "importedschema_ref" +attribute[].datatype REFERENCE +attribute[].collectiontype SINGLE +attribute[].dictionary.type BTREE +attribute[].dictionary.match UNCASED +attribute[].match UNCASED +attribute[].removeifzero false +attribute[].createifnonexistent false +attribute[].fastsearch false +attribute[].huge false +attribute[].paged false +attribute[].ismutable false +attribute[].sortascending true +attribute[].sortfunction UCA +attribute[].sortstrength PRIMARY +attribute[].sortlocale "" +attribute[].enablebitvectors false +attribute[].enableonlybitvector false +attribute[].fastaccess false +attribute[].arity 8 +attribute[].lowerbound -9223372036854775808 +attribute[].upperbound 9223372036854775807 +attribute[].densepostinglistthreshold 0.4 +attribute[].tensortype "" +attribute[].imported false +attribute[].distancemetric EUCLIDEAN +attribute[].index.hnsw.enabled false +attribute[].index.hnsw.maxlinkspernode 16 +attribute[].index.hnsw.neighborstoexploreatinsert 200 +attribute[].index.hnsw.distancemetric EUCLIDEAN +attribute[].index.hnsw.multithreadedindexing true +attribute[].name "child_field" +attribute[].datatype STRING +attribute[].collectiontype SINGLE +attribute[].dictionary.type BTREE +attribute[].dictionary.match UNCASED +attribute[].match UNCASED +attribute[].removeifzero false +attribute[].createifnonexistent false +attribute[].fastsearch false +attribute[].huge false +attribute[].paged false +attribute[].ismutable false +attribute[].sortascending true +attribute[].sortfunction UCA +attribute[].sortstrength PRIMARY +attribute[].sortlocale "" +attribute[].enablebitvectors false +attribute[].enableonlybitvector false +attribute[].fastaccess false +attribute[].arity 8 +attribute[].lowerbound -9223372036854775808 +attribute[].upperbound 9223372036854775807 +attribute[].densepostinglistthreshold 0.4 +attribute[].tensortype "" +attribute[].imported false +attribute[].distancemetric EUCLIDEAN +attribute[].index.hnsw.enabled false +attribute[].index.hnsw.maxlinkspernode 16 +attribute[].index.hnsw.neighborstoexploreatinsert 200 +attribute[].index.hnsw.distancemetric EUCLIDEAN +attribute[].index.hnsw.multithreadedindexing true +attribute[].name "parent_field" +attribute[].datatype STRING +attribute[].collectiontype SINGLE +attribute[].dictionary.type BTREE +attribute[].dictionary.match UNCASED +attribute[].match UNCASED +attribute[].removeifzero false +attribute[].createifnonexistent false +attribute[].fastsearch false +attribute[].huge false +attribute[].paged false +attribute[].ismutable false +attribute[].sortascending true +attribute[].sortfunction UCA +attribute[].sortstrength PRIMARY +attribute[].sortlocale "" +attribute[].enablebitvectors false +attribute[].enableonlybitvector false +attribute[].fastaccess false +attribute[].arity 8 +attribute[].lowerbound -9223372036854775808 +attribute[].upperbound 9223372036854775807 +attribute[].densepostinglistthreshold 0.4 +attribute[].tensortype "" +attribute[].imported false +attribute[].distancemetric EUCLIDEAN +attribute[].index.hnsw.enabled false +attribute[].index.hnsw.maxlinkspernode 16 +attribute[].index.hnsw.neighborstoexploreatinsert 200 +attribute[].index.hnsw.distancemetric EUCLIDEAN +attribute[].index.hnsw.multithreadedindexing true +attribute[].name "child_imported" +attribute[].datatype STRING +attribute[].collectiontype SINGLE +attribute[].dictionary.type BTREE +attribute[].dictionary.match UNCASED +attribute[].match UNCASED +attribute[].removeifzero false +attribute[].createifnonexistent false +attribute[].fastsearch false +attribute[].huge false +attribute[].paged false +attribute[].ismutable false +attribute[].sortascending true +attribute[].sortfunction UCA +attribute[].sortstrength PRIMARY +attribute[].sortlocale "" +attribute[].enablebitvectors false +attribute[].enableonlybitvector false +attribute[].fastaccess false +attribute[].arity 8 +attribute[].lowerbound -9223372036854775808 +attribute[].upperbound 9223372036854775807 +attribute[].densepostinglistthreshold 0.4 +attribute[].tensortype "" +attribute[].imported true +attribute[].distancemetric EUCLIDEAN +attribute[].index.hnsw.enabled false +attribute[].index.hnsw.maxlinkspernode 16 +attribute[].index.hnsw.neighborstoexploreatinsert 200 +attribute[].index.hnsw.distancemetric EUCLIDEAN +attribute[].index.hnsw.multithreadedindexing true diff --git a/config-model/src/test/derived/schemainheritance/child.sd b/config-model/src/test/derived/schemainheritance/child.sd new file mode 100644 index 00000000000..bacc3d984d8 --- /dev/null +++ b/config-model/src/test/derived/schemainheritance/child.sd @@ -0,0 +1,43 @@ +schema child { + + document child inherits parent { + + field cf1 type string { + indexing: summary + } + + } + + fieldset child_set { + fields: cf1, pf1 + } + + stemming: shortest + + index child_index { + stemming: shortest + } + + field child_field type string { + indexing: input pf1 | lowercase | index | attribute | summary + } + + rank-profile child_profile inherits parent_profile { + } + + constant child_constant { + file: constants/my_constant_tensor_file.json + type: tensor<float>(x{},y{}) + } + + onnx-model child_model { + file: small_constants_and_functions.onnx + } + + document-summary child_summary inherits parent_summary { + summary cf1 type string {} + } + + import field importedschema_ref.importedfield2 as child_imported {} + +} diff --git a/config-model/src/test/derived/schemainheritance/documentmanager.cfg b/config-model/src/test/derived/schemainheritance/documentmanager.cfg new file mode 100644 index 00000000000..df3345d30d2 --- /dev/null +++ b/config-model/src/test/derived/schemainheritance/documentmanager.cfg @@ -0,0 +1,93 @@ +enablecompression false +datatype[].id 1381038251 +datatype[].structtype[].name "position" +datatype[].structtype[].version 0 +datatype[].structtype[].compresstype NONE +datatype[].structtype[].compresslevel 0 +datatype[].structtype[].compressthreshold 95 +datatype[].structtype[].compressminsize 800 +datatype[].structtype[].field[].name "x" +datatype[].structtype[].field[].datatype 0 +datatype[].structtype[].field[].detailedtype "" +datatype[].structtype[].field[].name "y" +datatype[].structtype[].field[].datatype 0 +datatype[].structtype[].field[].detailedtype "" +datatype[].id 990242616 +datatype[].structtype[].name "importedschema.header" +datatype[].structtype[].version 0 +datatype[].structtype[].compresstype NONE +datatype[].structtype[].compresslevel 0 +datatype[].structtype[].compressthreshold 95 +datatype[].structtype[].compressminsize 800 +datatype[].structtype[].field[].name "importedfield1" +datatype[].structtype[].field[].datatype 2 +datatype[].structtype[].field[].detailedtype "" +datatype[].structtype[].field[].name "importedfield2" +datatype[].structtype[].field[].datatype 2 +datatype[].structtype[].field[].detailedtype "" +datatype[].id 167001639 +datatype[].documenttype[].name "importedschema" +datatype[].documenttype[].version 0 +datatype[].documenttype[].inherits[].name "document" +datatype[].documenttype[].inherits[].version 0 +datatype[].documenttype[].headerstruct 990242616 +datatype[].documenttype[].bodystruct 0 +datatype[].documenttype[].fieldsets{[]}.fields[] "importedfield1" +datatype[].documenttype[].fieldsets{[]}.fields[] "importedfield2" +datatype[].id -1266134872 +datatype[].referencetype[].target_type_id 167001639 +datatype[].id 836075987 +datatype[].structtype[].name "parent.header" +datatype[].structtype[].version 0 +datatype[].structtype[].compresstype NONE +datatype[].structtype[].compresslevel 0 +datatype[].structtype[].compressthreshold 95 +datatype[].structtype[].compressminsize 800 +datatype[].structtype[].field[].name "pf1" +datatype[].structtype[].field[].datatype 2 +datatype[].structtype[].field[].detailedtype "" +datatype[].structtype[].field[].name "importedschema_ref" +datatype[].structtype[].field[].datatype -1266134872 +datatype[].structtype[].field[].detailedtype "" +datatype[].structtype[].field[].name "parent_field" +datatype[].structtype[].field[].datatype 2 +datatype[].structtype[].field[].detailedtype "" +datatype[].id 1175161836 +datatype[].documenttype[].name "parent" +datatype[].documenttype[].version 0 +datatype[].documenttype[].inherits[].name "document" +datatype[].documenttype[].inherits[].version 0 +datatype[].documenttype[].headerstruct 836075987 +datatype[].documenttype[].bodystruct 0 +datatype[].documenttype[].fieldsets{parent_set}.fields[] "pf1" +datatype[].documenttype[].fieldsets{[]}.fields[] "importedschema_ref" +datatype[].documenttype[].fieldsets{[]}.fields[] "pf1" +datatype[].documenttype[].importedfield[].name "parent_imported" +datatype[].id 81425825 +datatype[].structtype[].name "child.header" +datatype[].structtype[].version 0 +datatype[].structtype[].compresstype NONE +datatype[].structtype[].compresslevel 0 +datatype[].structtype[].compressthreshold 95 +datatype[].structtype[].compressminsize 800 +datatype[].structtype[].field[].name "cf1" +datatype[].structtype[].field[].datatype 2 +datatype[].structtype[].field[].detailedtype "" +datatype[].structtype[].field[].name "child_field" +datatype[].structtype[].field[].datatype 2 +datatype[].structtype[].field[].detailedtype "" +datatype[].id 746267614 +datatype[].documenttype[].name "child" +datatype[].documenttype[].version 0 +datatype[].documenttype[].inherits[].name "document" +datatype[].documenttype[].inherits[].version 0 +datatype[].documenttype[].inherits[].name "parent" +datatype[].documenttype[].inherits[].version 0 +datatype[].documenttype[].headerstruct 81425825 +datatype[].documenttype[].bodystruct 0 +datatype[].documenttype[].fieldsets{child_set}.fields[] "cf1" +datatype[].documenttype[].fieldsets{child_set}.fields[] "pf1" +datatype[].documenttype[].fieldsets{[]}.fields[] "cf1" +datatype[].documenttype[].fieldsets{[]}.fields[] "importedschema_ref" +datatype[].documenttype[].fieldsets{[]}.fields[] "pf1" +datatype[].documenttype[].importedfield[].name "child_imported" diff --git a/config-model/src/test/derived/schemainheritance/ilscripts.cfg b/config-model/src/test/derived/schemainheritance/ilscripts.cfg new file mode 100644 index 00000000000..0a8e10859a0 --- /dev/null +++ b/config-model/src/test/derived/schemainheritance/ilscripts.cfg @@ -0,0 +1,11 @@ +maxtermoccurrences 100 +fieldmatchmaxlength 1000000 +ilscript[].doctype "child" +ilscript[].docfield[] "pf1" +ilscript[].docfield[] "importedschema_ref" +ilscript[].docfield[] "cf1" +ilscript[].content[] "clear_state | guard { input pf1 | lowercase | tokenize normalize stem:\"SHORTEST\" | index child_field | attribute child_field | summary child_field; }" +ilscript[].content[] "clear_state | guard { input pf1 | lowercase | tokenize normalize | index parent_field | attribute parent_field | summary parent_field; }" +ilscript[].content[] "clear_state | guard { input pf1 | summary pf1; }" +ilscript[].content[] "clear_state | guard { input importedschema_ref | attribute importedschema_ref; }" +ilscript[].content[] "clear_state | guard { input cf1 | summary cf1; }" diff --git a/config-model/src/test/derived/schemainheritance/importedschema.sd b/config-model/src/test/derived/schemainheritance/importedschema.sd new file mode 100644 index 00000000000..1b5acff8a26 --- /dev/null +++ b/config-model/src/test/derived/schemainheritance/importedschema.sd @@ -0,0 +1,15 @@ +schema importedschema { + + document importedschema { + + field importedfield1 type string { + indexing: attribute + } + + field importedfield2 type string { + indexing: attribute + } + + } + +}
\ No newline at end of file diff --git a/config-model/src/test/derived/schemainheritance/index-info.cfg b/config-model/src/test/derived/schemainheritance/index-info.cfg new file mode 100644 index 00000000000..10c468b19c2 --- /dev/null +++ b/config-model/src/test/derived/schemainheritance/index-info.cfg @@ -0,0 +1,59 @@ +indexinfo[].name "child" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "word" +indexinfo[].command[].indexname "pf1" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "pf1" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "importedschema_ref" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "importedschema_ref" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "importedschema_ref" +indexinfo[].command[].command "type Reference<importedschema>" +indexinfo[].command[].indexname "importedschema_ref" +indexinfo[].command[].command "word" +indexinfo[].command[].indexname "cf1" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "cf1" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "child_field" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "child_field" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "child_field" +indexinfo[].command[].command "stem:SHORTEST" +indexinfo[].command[].indexname "child_field" +indexinfo[].command[].command "normalize" +indexinfo[].command[].indexname "child_field" +indexinfo[].command[].command "plain-tokens" +indexinfo[].command[].indexname "child_field" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "parent_field" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "parent_field" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "parent_field" +indexinfo[].command[].command "stem:SHORTEST" +indexinfo[].command[].indexname "parent_field" +indexinfo[].command[].command "normalize" +indexinfo[].command[].indexname "parent_field" +indexinfo[].command[].command "plain-tokens" +indexinfo[].command[].indexname "parent_field" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "child_imported" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "child_imported" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "child_imported" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "child_imported" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "child_imported" +indexinfo[].command[].command "word" +indexinfo[].command[].indexname "child_set" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "child_set" +indexinfo[].command[].command "index" diff --git a/config-model/src/test/derived/schemainheritance/parent.sd b/config-model/src/test/derived/schemainheritance/parent.sd new file mode 100644 index 00000000000..51b11dad444 --- /dev/null +++ b/config-model/src/test/derived/schemainheritance/parent.sd @@ -0,0 +1,41 @@ +schema parent { + + document parent { + + field pf1 type string { + indexing: summary + } + + field importedschema_ref type reference<importedschema> { + indexing: attribute + } + + } + + fieldset parent_set { + fields: pf1 + } + stemming: none + index parent_index { + stemming: best + } + field parent_field type string { + indexing: input pf1 | lowercase | index | attribute | summary + } + rank-profile parent_profile { + } + constant parent_constant { + file: constants/my_constant_tensor_file.json + type: tensor<float>(x{},y{}) + } + onnx-model parent_model { + file: small_constants_and_functions.onnx + } + document-summary parent_summary { + summary pf1 type string { + } + } + import field importedschema_ref.importedfield1 as parent_imported { + } + raw-as-base64-in-summary +} diff --git a/config-model/src/test/derived/schemainheritance/rank-profiles.cfg b/config-model/src/test/derived/schemainheritance/rank-profiles.cfg new file mode 100644 index 00000000000..9e68045fab0 --- /dev/null +++ b/config-model/src/test/derived/schemainheritance/rank-profiles.cfg @@ -0,0 +1,11 @@ +rankprofile[].name "default" +rankprofile[].name "unranked" +rankprofile[].fef.property[].name "vespa.rank.firstphase" +rankprofile[].fef.property[].value "value(0)" +rankprofile[].fef.property[].name "vespa.hitcollector.heapsize" +rankprofile[].fef.property[].value "0" +rankprofile[].fef.property[].name "vespa.hitcollector.arraysize" +rankprofile[].fef.property[].value "0" +rankprofile[].fef.property[].name "vespa.dump.ignoredefaultfeatures" +rankprofile[].fef.property[].value "true" +rankprofile[].name "child_profile" diff --git a/config-model/src/test/derived/schemainheritance/small_constants_and_functions.onnx b/config-model/src/test/derived/schemainheritance/small_constants_and_functions.onnx Binary files differnew file mode 100644 index 00000000000..0d4bffa5b57 --- /dev/null +++ b/config-model/src/test/derived/schemainheritance/small_constants_and_functions.onnx diff --git a/config-model/src/test/derived/schemainheritance/summary.cfg b/config-model/src/test/derived/schemainheritance/summary.cfg new file mode 100644 index 00000000000..7019054b8fa --- /dev/null +++ b/config-model/src/test/derived/schemainheritance/summary.cfg @@ -0,0 +1,38 @@ +defaultsummaryid 1868070885 +classes[].id 1868070885 +classes[].name "default" +classes[].omitsummaryfeatures false +classes[].fields[].name "child_field" +classes[].fields[].type "longstring" +classes[].fields[].name "pf1" +classes[].fields[].type "longstring" +classes[].fields[].name "parent_field" +classes[].fields[].type "longstring" +classes[].fields[].name "cf1" +classes[].fields[].type "longstring" +classes[].fields[].name "rankfeatures" +classes[].fields[].type "featuredata" +classes[].fields[].name "summaryfeatures" +classes[].fields[].type "featuredata" +classes[].fields[].name "documentid" +classes[].fields[].type "longstring" +classes[].id 1694225577 +classes[].name "child_summary" +classes[].omitsummaryfeatures false +classes[].fields[].name "cf1" +classes[].fields[].type "longstring" +classes[].fields[].name "rankfeatures" +classes[].fields[].type "featuredata" +classes[].fields[].name "summaryfeatures" +classes[].fields[].type "featuredata" +classes[].id 1822613042 +classes[].name "attributeprefetch" +classes[].omitsummaryfeatures false +classes[].fields[].name "child_field" +classes[].fields[].type "longstring" +classes[].fields[].name "parent_field" +classes[].fields[].type "longstring" +classes[].fields[].name "rankfeatures" +classes[].fields[].type "featuredata" +classes[].fields[].name "summaryfeatures" +classes[].fields[].type "featuredata" diff --git a/config-model/src/test/derived/schemainheritance/summarymap.cfg b/config-model/src/test/derived/schemainheritance/summarymap.cfg new file mode 100644 index 00000000000..ad98cbe76e7 --- /dev/null +++ b/config-model/src/test/derived/schemainheritance/summarymap.cfg @@ -0,0 +1,13 @@ +defaultoutputclass -1 +override[].field "rankfeatures" +override[].command "rankfeatures" +override[].arguments "" +override[].field "summaryfeatures" +override[].command "summaryfeatures" +override[].arguments "" +override[].field "child_field" +override[].command "attribute" +override[].arguments "child_field" +override[].field "parent_field" +override[].command "attribute" +override[].arguments "parent_field" diff --git a/config-model/src/test/derived/schemainheritance/vsmsummary.cfg b/config-model/src/test/derived/schemainheritance/vsmsummary.cfg new file mode 100644 index 00000000000..91ca5363a25 --- /dev/null +++ b/config-model/src/test/derived/schemainheritance/vsmsummary.cfg @@ -0,0 +1,17 @@ +outputclass "" +fieldmap[].summary "child_field" +fieldmap[].document[].field "child_field" +fieldmap[].command NONE +fieldmap[].summary "pf1" +fieldmap[].document[].field "pf1" +fieldmap[].command NONE +fieldmap[].summary "parent_field" +fieldmap[].document[].field "parent_field" +fieldmap[].command NONE +fieldmap[].summary "cf1" +fieldmap[].document[].field "cf1" +fieldmap[].command NONE +fieldmap[].summary "rankfeatures" +fieldmap[].command NONE +fieldmap[].summary "summaryfeatures" +fieldmap[].command NONE diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java index 0f9951b707b..329d27472c2 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java @@ -134,6 +134,7 @@ public class SchemaTestCase { " import field parentschema_ref.name as child_imported {}" + "}"); + System.out.println(parentLines); SearchBuilder builder = new SearchBuilder(new DeployLoggerStub()); builder.processorsToSkip().add(OnnxModelTypeResolver.class); // Avoid discovering the Onnx model referenced does not exist builder.processorsToSkip().add(ImportedFieldsResolver.class); // Avoid discovering the document reference leads nowhere diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java index 3394db6869e..9ba9f3b37f7 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java @@ -50,7 +50,8 @@ public abstract class AbstractExportingTestCase extends AbstractSchemaTestCase { properties, builder.getRankProfileRegistry(), builder.getQueryProfileRegistry(), - new ImportedMlModels(), new InThreadExecutorService()); + new ImportedMlModels(), + new InThreadExecutorService()); return export(dirName, builder, config); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SchemaInheritanceTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SchemaInheritanceTestCase.java new file mode 100644 index 00000000000..25195587cd2 --- /dev/null +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SchemaInheritanceTestCase.java @@ -0,0 +1,28 @@ +// 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.application.provider.MockFileRegistry; +import com.yahoo.config.model.deploy.TestProperties; +import com.yahoo.searchdefinition.RankProfileRegistry; +import com.yahoo.searchdefinition.SearchBuilder; +import com.yahoo.searchdefinition.parser.ParseException; +import org.junit.Test; + +import java.io.IOException; + +/** + * @author bratseth + */ +public class SchemaInheritanceTestCase extends AbstractExportingTestCase { + + @Test + public void testIt() throws IOException, ParseException { + SearchBuilder builder = SearchBuilder.createFromDirectory("src/test/derived/schemainheritance/", + new MockFileRegistry(), + new TestableDeployLogger(), + new TestProperties()); + derive("schemainheritance", builder, builder.getSearch("child")); + assertCorrectConfigFiles("schemainheritance"); + } + +} |