diff options
author | Jon Bratseth <bratseth@gmail.com> | 2021-10-19 15:26:42 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2021-10-19 15:26:42 +0200 |
commit | 5cb59ac0fee4d641b655f3aa789632e2cfea81ad (patch) | |
tree | 8c9224cf6057f479d33a57ba40289c7608a91880 /config-model | |
parent | 43145b73ee81d4656c6869117c80177837044fa8 (diff) |
Inherit raw-as-base64
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/searchdefinition/Schema.java | 8 | ||||
-rw-r--r-- | config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java b/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java index 252db79e72b..e8e7c999c07 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java @@ -62,7 +62,7 @@ public class Schema implements ImmutableSchema { /** True if this doesn't define a search, just a document type */ private final boolean documentsOnly; - private boolean rawAsBase64 = false; + private Boolean rawAsBase64 = null; /** The stemming setting of this schema. Default is BEST. */ private Stemming stemming = null; @@ -173,7 +173,11 @@ public class Schema implements ImmutableSchema { * * @return true if raw shall be encoded as base64 in summary */ - public boolean isRawAsBase64() { return rawAsBase64; } + public boolean isRawAsBase64() { + if (rawAsBase64 != null) return rawAsBase64; + if (inherited.isEmpty()) return false; + return requireInherited().isRawAsBase64(); + } public void enableRawAsBase64() { rawAsBase64 = true; } 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 cff9d6ceb37..f185867a2df 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java @@ -100,6 +100,7 @@ public class SchemaTestCase { " summary pf1 type string {}" + " }" + " import field parentschema_ref.name as parent_imported {}" + + " raw-as-base64-in-summary" + "}"); String childLines = joinLines( "schema child inherits parent {" + @@ -136,6 +137,7 @@ public class SchemaTestCase { assertNotNull(child.getUniqueNamedSummaryFields().get("pf1")); assertTrue(child.temporaryImportedFields().isPresent()); assertNotNull(child.temporaryImportedFields().get().fields().get("parent_imported")); + assertTrue(child.isRawAsBase64()); } } |