diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2024-03-13 10:46:34 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2024-03-13 16:41:21 +0100 |
commit | 4528b9f815cf780fbda7ee0d041b8070a39d518d (patch) | |
tree | 4bbc1d7ea32a93b2c4097f6ad997acb2882307eb /config-model/src/main/java/com/yahoo/schema | |
parent | 37484d712d93d7daf6075455b266f18788d40690 (diff) |
Use a single searchcluster with both indexed and streaming docs.
Diffstat (limited to 'config-model/src/main/java/com/yahoo/schema')
-rw-r--r-- | config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java | 23 | ||||
-rw-r--r-- | config-model/src/main/java/com/yahoo/schema/derived/SchemaInfo.java | 21 |
2 files changed, 34 insertions, 10 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java b/config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java index b35918b3460..a7f66966538 100644 --- a/config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java +++ b/config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java @@ -28,7 +28,7 @@ import java.io.Writer; public class DerivedConfiguration { private final Schema schema; - private final boolean isStreaming; + private final SchemaInfo.IndexMode indexMode; private Summaries summaries; private Juniperrc juniperrc; private AttributeFields attributeFields; @@ -57,7 +57,8 @@ public class DerivedConfiguration { } DerivedConfiguration(Schema schema, RankProfileRegistry rankProfileRegistry, QueryProfileRegistry queryProfiles) { - this(schema, new DeployState.Builder().rankProfileRegistry(rankProfileRegistry).queryProfiles(queryProfiles).build(), false); + this(new DeployState.Builder().rankProfileRegistry(rankProfileRegistry).queryProfiles(queryProfiles).build(), + schema, SchemaInfo.IndexMode.INDEX); } /** @@ -67,8 +68,8 @@ public class DerivedConfiguration { * argument is live. Which means that this object will be inconsistent if the given * schema is later modified. */ - public DerivedConfiguration(Schema schema, DeployState deployState, boolean isStreaming) { - this.isStreaming = isStreaming; + public DerivedConfiguration(DeployState deployState, Schema schema, SchemaInfo.IndexMode indexMode) { + this.indexMode = indexMode; try { Validator.ensureNotNull("Schema", schema); this.schema = schema; @@ -81,9 +82,9 @@ public class DerivedConfiguration { summaries = new Summaries(schema, deployState.getDeployLogger(), deployState.getProperties().featureFlags()); juniperrc = new Juniperrc(schema); rankProfileList = new RankProfileList(schema, schema.rankExpressionFiles(), attributeFields, deployState); - indexingScript = new IndexingScript(schema, isStreaming); - indexInfo = new IndexInfo(schema, isStreaming); - schemaInfo = new SchemaInfo(schema, deployState.rankProfileRegistry(), summaries); + indexingScript = new IndexingScript(schema, isStreaming()); + indexInfo = new IndexInfo(schema, isStreaming()); + schemaInfo = new SchemaInfo(schema, indexMode, deployState.rankProfileRegistry(), summaries); indexSchema = new IndexSchema(schema); importedFields = new ImportedFields(schema); } @@ -153,7 +154,7 @@ public class DerivedConfiguration { } public boolean isStreaming() { - return isStreaming; + return indexMode == SchemaInfo.IndexMode.STREAMING; } public Summaries getSummaries() { @@ -165,7 +166,11 @@ public class DerivedConfiguration { } public void getConfig(AttributesConfig.Builder builder) { - getConfig(builder, AttributeFields.FieldSet.ALL); + if (isStreaming()) { + getConfig(builder, AttributeFields.FieldSet.FAST_ACCESS); + } else { + getConfig(builder, AttributeFields.FieldSet.ALL); + } } public void getConfig(AttributesConfig.Builder builder, AttributeFields.FieldSet fs) { diff --git a/config-model/src/main/java/com/yahoo/schema/derived/SchemaInfo.java b/config-model/src/main/java/com/yahoo/schema/derived/SchemaInfo.java index 19a045ac444..f996b2624db 100644 --- a/config-model/src/main/java/com/yahoo/schema/derived/SchemaInfo.java +++ b/config-model/src/main/java/com/yahoo/schema/derived/SchemaInfo.java @@ -42,13 +42,32 @@ public final class SchemaInfo extends Derived { private final Map<String, RankProfileInfo> rankProfiles; private final Summaries summaries; + private final IndexMode indexMode; - public SchemaInfo(Schema schema, RankProfileRegistry rankProfileRegistry, Summaries summaries) { + public enum IndexMode {INDEX, STREAMING, STORE_ONLY} + + public SchemaInfo(Schema schema, String indexMode, RankProfileRegistry rankProfileRegistry, Summaries summaries) { + this(schema, indexMode(indexMode), rankProfileRegistry, summaries); + } + public SchemaInfo(Schema schema, IndexMode indexMode, RankProfileRegistry rankProfileRegistry, Summaries summaries) { this.schema = schema; this.rankProfiles = Collections.unmodifiableMap(toRankProfiles(rankProfileRegistry.rankProfilesOf(schema))); this.summaries = summaries; + this.indexMode = indexMode; } + private static IndexMode indexMode(String mode) { + if (mode == null) return IndexMode.INDEX; + return switch (mode) { + case "index" -> IndexMode.INDEX; + case "streaming" -> IndexMode.STREAMING; + case "store-only" -> IndexMode.STORE_ONLY; + default -> IndexMode.STORE_ONLY; + }; + } + + public IndexMode getIndexMode() { return indexMode; } + public String name() { return schema.getName(); } @Override |