aboutsummaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-05-03 17:49:31 +0200
committerJon Bratseth <bratseth@gmail.com>2022-05-03 17:49:31 +0200
commitbc6befc9b62b32ed1c57cbfcf70dd198da9d59ac (patch)
treea30344e75a6b65cd4cf8f7bb393c13bae7a0b343 /container-search
parent9e4c738e9e994124d96cede78449d2d558d4977f (diff)
Use schemsa-info
Diffstat (limited to 'container-search')
-rw-r--r--container-search/abi-spec.json87
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java18
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinition.java92
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinitionSet.java34
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumField.java5
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/fastsearch/DocumentDatabase.java44
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java10
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java13
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/fastsearch/VespaBackEndSearcher.java16
-rw-r--r--container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcProtobufFillInvoker.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/schema/DocumentSummary.java160
-rw-r--r--container-search/src/main/java/com/yahoo/search/schema/RankProfile.java6
-rw-r--r--container-search/src/main/java/com/yahoo/search/schema/Schema.java20
-rw-r--r--container-search/src/main/java/com/yahoo/search/schema/SchemaInfo.java33
-rw-r--r--container-search/src/main/java/com/yahoo/search/schema/SchemaInfoConfigurer.java18
-rw-r--r--container-search/src/main/java/com/yahoo/search/searchchain/ExecutionFactory.java31
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java2
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/SlimeSummaryTestCase.java69
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/partial-summary1.cfg10
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/partial-summary2.cfg12
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/partial-summary3.cfg10
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/summary.cfg36
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/test/DocsumDefinitionTestCase.java57
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java25
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/test/documentdb-info.cfg353
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/vespa/HitConverterTestCase.java14
-rw-r--r--container-search/src/test/java/com/yahoo/search/schema/SchemaInfoTester.java22
-rw-r--r--container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java10
28 files changed, 542 insertions, 667 deletions
diff --git a/container-search/abi-spec.json b/container-search/abi-spec.json
index fb1740d0e5e..b4ac714b9d2 100644
--- a/container-search/abi-spec.json
+++ b/container-search/abi-spec.json
@@ -7980,6 +7980,88 @@
],
"fields": []
},
+ "com.yahoo.search.schema.DocumentSummary$Builder": {
+ "superClass": "java.lang.Object",
+ "interfaces": [],
+ "attributes": [
+ "public"
+ ],
+ "methods": [
+ "public void <init>(java.lang.String)",
+ "public com.yahoo.search.schema.DocumentSummary$Builder add(com.yahoo.search.schema.DocumentSummary$Field)",
+ "public com.yahoo.search.schema.DocumentSummary$Builder setDynamic(boolean)",
+ "public com.yahoo.search.schema.DocumentSummary build()"
+ ],
+ "fields": []
+ },
+ "com.yahoo.search.schema.DocumentSummary$Field$Type": {
+ "superClass": "java.lang.Enum",
+ "interfaces": [],
+ "attributes": [
+ "public",
+ "final",
+ "enum"
+ ],
+ "methods": [
+ "public static com.yahoo.search.schema.DocumentSummary$Field$Type[] values()",
+ "public static com.yahoo.search.schema.DocumentSummary$Field$Type valueOf(java.lang.String)",
+ "public java.lang.String asString()",
+ "public java.lang.String toString()",
+ "public static com.yahoo.search.schema.DocumentSummary$Field$Type fromString(java.lang.String)"
+ ],
+ "fields": [
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type bool",
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type byteType",
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type shortType",
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type integer",
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type int64",
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type float16",
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type floatType",
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type doubleType",
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type string",
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type data",
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type raw",
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type longstring",
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type longdata",
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type jsonstring",
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type featuredata",
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type xmlstring",
+ "public static final enum com.yahoo.search.schema.DocumentSummary$Field$Type tensor"
+ ]
+ },
+ "com.yahoo.search.schema.DocumentSummary$Field": {
+ "superClass": "java.lang.Object",
+ "interfaces": [],
+ "attributes": [
+ "public"
+ ],
+ "methods": [
+ "public void <init>(java.lang.String, java.lang.String)",
+ "public void <init>(java.lang.String, com.yahoo.search.schema.DocumentSummary$Field$Type)",
+ "public java.lang.String name()",
+ "public com.yahoo.search.schema.DocumentSummary$Field$Type type()",
+ "public boolean equals(java.lang.Object)",
+ "public int hashCode()",
+ "public java.lang.String toString()"
+ ],
+ "fields": []
+ },
+ "com.yahoo.search.schema.DocumentSummary": {
+ "superClass": "java.lang.Object",
+ "interfaces": [],
+ "attributes": [
+ "public"
+ ],
+ "methods": [
+ "public java.lang.String name()",
+ "public java.util.List fields()",
+ "public boolean isDynamic()",
+ "public boolean equals(java.lang.Object)",
+ "public int hashCode()",
+ "public java.lang.String toString()"
+ ],
+ "fields": []
+ },
"com.yahoo.search.schema.RankProfile$Builder": {
"superClass": "java.lang.Object",
"interfaces": [],
@@ -8021,6 +8103,7 @@
"methods": [
"public void <init>(java.lang.String)",
"public com.yahoo.search.schema.Schema$Builder add(com.yahoo.search.schema.RankProfile)",
+ "public com.yahoo.search.schema.Schema$Builder add(com.yahoo.search.schema.DocumentSummary)",
"public com.yahoo.search.schema.Schema build()"
],
"fields": []
@@ -8034,6 +8117,7 @@
"methods": [
"public java.lang.String name()",
"public java.util.Map rankProfiles()",
+ "public java.util.Map documentSummaries()",
"public boolean equals(java.lang.Object)",
"public int hashCode()",
"public java.lang.String toString()"
@@ -8060,7 +8144,7 @@
"methods": [
"public void <init>(com.yahoo.search.config.IndexInfoConfig, com.yahoo.search.config.SchemaInfoConfig, com.yahoo.container.QrSearchersConfig)",
"public void <init>(java.util.List, java.util.Map)",
- "public java.util.List schemas()",
+ "public java.util.Map schemas()",
"public com.yahoo.search.schema.SchemaInfo$Session newSession(com.yahoo.search.Query)",
"public static com.yahoo.search.schema.SchemaInfo empty()",
"public boolean equals(java.lang.Object)",
@@ -8164,6 +8248,7 @@
],
"methods": [
"public void <init>(com.yahoo.container.core.ChainsConfig, com.yahoo.search.config.IndexInfoConfig, com.yahoo.search.config.SchemaInfoConfig, com.yahoo.container.QrSearchersConfig, com.yahoo.component.provider.ComponentRegistry, com.yahoo.vespa.configdefinition.SpecialtokensConfig, com.yahoo.language.Linguistics, com.yahoo.component.provider.ComponentRegistry, java.util.concurrent.Executor)",
+ "public void <init>(com.yahoo.container.core.ChainsConfig, com.yahoo.search.config.IndexInfoConfig, com.yahoo.search.schema.SchemaInfo, com.yahoo.container.QrSearchersConfig, com.yahoo.component.provider.ComponentRegistry, com.yahoo.vespa.configdefinition.SpecialtokensConfig, com.yahoo.language.Linguistics, com.yahoo.component.provider.ComponentRegistry, java.util.concurrent.Executor)",
"public void <init>(com.yahoo.container.core.ChainsConfig, com.yahoo.search.config.IndexInfoConfig, com.yahoo.container.QrSearchersConfig, com.yahoo.component.provider.ComponentRegistry, com.yahoo.vespa.configdefinition.SpecialtokensConfig, com.yahoo.language.Linguistics, com.yahoo.component.provider.ComponentRegistry, java.util.concurrent.Executor)",
"public void <init>(com.yahoo.container.core.ChainsConfig, com.yahoo.search.config.IndexInfoConfig, com.yahoo.container.QrSearchersConfig, com.yahoo.component.provider.ComponentRegistry, com.yahoo.vespa.configdefinition.SpecialtokensConfig, com.yahoo.language.Linguistics, com.yahoo.component.provider.ComponentRegistry)",
"public com.yahoo.search.searchchain.Execution newExecution(com.yahoo.component.chain.Chain)",
diff --git a/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java b/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java
index 3953190eac4..23ba3b0619c 100644
--- a/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java
+++ b/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java
@@ -18,9 +18,11 @@ import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.Searcher;
import com.yahoo.search.config.ClusterConfig;
+import com.yahoo.search.config.SchemaInfoConfig;
import com.yahoo.search.dispatch.Dispatcher;
import com.yahoo.search.query.ParameterParser;
import com.yahoo.search.result.ErrorMessage;
+import com.yahoo.search.schema.SchemaInfo;
import com.yahoo.search.searchchain.Execution;
import com.yahoo.vespa.streamingvisitors.VdsStreamingSearcher;
import com.yahoo.yolean.Exceptions;
@@ -76,6 +78,7 @@ public class ClusterSearcher extends Searcher {
QrSearchersConfig qrsConfig,
ClusterConfig clusterConfig,
DocumentdbInfoConfig documentDbConfig,
+ SchemaInfo schemaInfo,
ComponentRegistry<Dispatcher> dispatchers,
VipStatus vipStatus,
VespaDocumentAccess access) {
@@ -99,11 +102,11 @@ public class ClusterSearcher extends Searcher {
String uniqueServerId = UUID.randomUUID().toString();
if (searchClusterConfig.indexingmode() == STREAMING) {
server = vdsCluster(uniqueServerId, searchClusterIndex,
- searchClusterConfig, docSumParams, documentDbConfig, access);
+ searchClusterConfig, docSumParams, documentDbConfig, schemaInfo, access);
vipStatus.addToRotation(server.getName());
} else {
server = searchDispatch(searchClusterIndex, searchClusterName, uniqueServerId,
- docSumParams, documentDbConfig, dispatchers);
+ docSumParams, documentDbConfig, schemaInfo, dispatchers);
}
}
@@ -125,6 +128,7 @@ public class ClusterSearcher extends Searcher {
String serverId,
SummaryParameters docSumParams,
DocumentdbInfoConfig documentdbInfoConfig,
+ SchemaInfo schemaInfo,
ComponentRegistry<Dispatcher> dispatchers) {
ClusterParams clusterParams = makeClusterParams(searchclusterIndex);
ComponentId dispatcherComponentId = new ComponentId("dispatcher." + searchClusterName);
@@ -132,7 +136,7 @@ public class ClusterSearcher extends Searcher {
if (dispatcher == null)
throw new IllegalArgumentException("Configuration error: No dispatcher " + dispatcherComponentId +
" is configured");
- return new FastSearcher(serverId, dispatcher, docSumParams, clusterParams, documentdbInfoConfig);
+ return new FastSearcher(serverId, dispatcher, docSumParams, clusterParams, documentdbInfoConfig, schemaInfo);
}
private static VdsStreamingSearcher vdsCluster(String serverId,
@@ -140,6 +144,7 @@ public class ClusterSearcher extends Searcher {
QrSearchersConfig.Searchcluster searchClusterConfig,
SummaryParameters docSumParams,
DocumentdbInfoConfig documentdbInfoConfig,
+ SchemaInfo schemaInfo,
VespaDocumentAccess access) {
if (searchClusterConfig.searchdef().size() != 1) {
throw new IllegalArgumentException("Search clusters in streaming search shall only contain a single searchdefinition : " + searchClusterConfig.searchdef());
@@ -149,7 +154,7 @@ public class ClusterSearcher extends Searcher {
searcher.setSearchClusterName(searchClusterConfig.rankprofiles().configid());
searcher.setDocumentType(searchClusterConfig.searchdef(0));
searcher.setStorageClusterRouteSpec(searchClusterConfig.storagecluster().routespec());
- searcher.init(serverId, docSumParams, clusterParams, documentdbInfoConfig);
+ searcher.init(serverId, docSumParams, clusterParams, documentdbInfoConfig, schemaInfo);
return searcher;
}
@@ -218,7 +223,7 @@ public class ClusterSearcher extends Searcher {
}
private Set<String> schemasHavingProfile(String profile, Execution.Context context) {
- return context.schemaInfo().schemas().stream()
+ return context.schemaInfo().schemas().values().stream()
.filter(schema -> schema.rankProfiles().containsKey(profile))
.map(schema -> schema.name())
.collect(Collectors.toSet());
@@ -234,7 +239,8 @@ public class ClusterSearcher extends Searcher {
searcher.fill(result, summaryClass, execution);
} else {
if (result.hits().getErrorHit() == null) {
- result.hits().addError(ErrorMessage.createTimeout("No time left to get summaries, query timeout was " + query.getTimeout() + " ms"));
+ result.hits().addError(ErrorMessage.createTimeout("No time left to get summaries, query timeout was " +
+ query.getTimeout() + " ms"));
}
}
} else {
diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinition.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinition.java
index 8a7d14d5f49..33b912da42f 100644
--- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinition.java
+++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinition.java
@@ -1,15 +1,11 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.fastsearch;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
import com.yahoo.data.access.Inspector;
+import com.yahoo.search.schema.DocumentSummary;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
import java.util.Map;
-import java.util.Set;
+import java.util.stream.Collectors;
/**
* A docsum definition which knows how to decode a certain class of document
@@ -21,55 +17,26 @@ import java.util.Set;
public class DocsumDefinition {
private final String name;
- private final ImmutableList<DocsumField> fields;
+ private final Map<String, DocsumField> fields;
/** True if this contains dynamic fields */
private final boolean dynamic;
- // Mapping between field names and their index in this.fields
- private final ImmutableMap<String, Integer> fieldNameToIndex;
-
- public DocsumDefinition(String name, List<DocsumField> fields) {
- this.name = name;
- this.dynamic = false;
- this.fields = ImmutableList.copyOf(fields);
- ImmutableMap.Builder<String, Integer> fieldNameToIndexBuilder = new ImmutableMap.Builder<>();
- int i = 0;
- for (DocsumField field : fields)
- fieldNameToIndexBuilder.put(field.name, i++);
- this.fieldNameToIndex = fieldNameToIndexBuilder.build();
+ public DocsumDefinition(DocumentSummary documentSummary) {
+ this.name = documentSummary.name();
+ this.dynamic = documentSummary.isDynamic();
+ this.fields = documentSummary.fields()
+ .stream()
+ .map(field -> DocsumField.create(field.name(), field.type().asString()))
+ .collect(Collectors.toUnmodifiableMap(field -> field.getName(),
+ field -> field));
}
- DocsumDefinition(DocumentdbInfoConfig.Documentdb.Summaryclass config) {
- this.name = config.name();
-
- List<DocsumField> fieldsBuilder = new ArrayList<>();
- Map<String, Integer> fieldNameToIndexBuilder = new HashMap<>();
- boolean dynamic = false;
- for (DocumentdbInfoConfig.Documentdb.Summaryclass.Fields field : config.fields()) {
- // no, don't switch the order of the two next lines :)
- fieldNameToIndexBuilder.put(field.name(), fieldsBuilder.size());
- fieldsBuilder.add(DocsumField.create(field.name(), field.type()));
- if (field.dynamic())
- dynamic = true;
- }
- this.dynamic = dynamic;
- fields = ImmutableList.copyOf(fieldsBuilder);
- fieldNameToIndex = ImmutableMap.copyOf(fieldNameToIndexBuilder);
- }
-
- /** Returns the field at this index, or null if none */
- public DocsumField getField(int fieldIndex) {
- if (fieldIndex >= fields.size()) return null;
- return fields.get(fieldIndex);
- }
+ public String name() { return name; }
+ public Map<String, DocsumField> fields() { return fields; }
- /** Returns the field with this name, or null if none */
- public DocsumField getField(String fieldName) {
- Integer index = fieldNameToIndex.get(fieldName);
- if (index == null) return null;
- return getField(index);
- }
+ /** Returns whether this summary contains one or more dynamic fields */
+ public boolean isDynamic() { return dynamic; }
/**
* Returns the given slime value as the type specified in this, or null if the type is not known.
@@ -78,35 +45,14 @@ public class DocsumDefinition {
* another has not.
*/
public Object convert(String fieldName, Inspector value) {
- DocsumField fieldType = getField(fieldName);
- if (fieldType == null || ! value.valid()) return null;
- return fieldType.convert(value);
- }
-
- public Set<String> fieldNames() {
- return fieldNameToIndex.keySet();
+ DocsumField field = fields.get(fieldName);
+ if (field == null || ! value.valid()) return null;
+ return field.convert(value);
}
@Override
public String toString() {
- return "docsum definition '" + getName() + "'";
- }
-
- public String getName() {
- return name;
- }
-
- public int getFieldCount() {
- return fields.size();
- }
-
- public List<DocsumField> getFields() {
- return fields;
- }
-
- /** Returns whether this summary contains one or more dynamic fields */
- public boolean isDynamic() {
- return dynamic;
+ return "docsum definition '" + name() + "'";
}
}
diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinitionSet.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinitionSet.java
index 1e0cfa3be9e..2b26cd29b78 100644
--- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinitionSet.java
+++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinitionSet.java
@@ -1,7 +1,8 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.fastsearch;
-import com.google.common.collect.ImmutableMap;
+import com.yahoo.search.schema.DocumentSummary;
+import com.yahoo.search.schema.Schema;
import com.yahoo.slime.BinaryFormat;
import com.yahoo.data.access.Inspector;
import com.yahoo.slime.Slime;
@@ -10,7 +11,6 @@ import com.yahoo.prelude.ConfigurationException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import java.util.logging.Logger;
@@ -31,12 +31,15 @@ public final class DocsumDefinitionSet {
private final Map<String, DocsumDefinition> definitionsByName;
- public DocsumDefinitionSet(DocumentdbInfoConfig.Documentdb config) {
- this(toDocsums(config));
+ public DocsumDefinitionSet(Schema schema) {
+ this(schema.documentSummaries().values());
}
- public DocsumDefinitionSet(Collection<DocsumDefinition> docsumDefinitions) {
- this.definitionsByName = ImmutableMap.copyOf(docsumDefinitions.stream().collect(Collectors.toMap(DocsumDefinition::getName, p -> p)));
+ public DocsumDefinitionSet(Collection<DocumentSummary> docsumDefinitions) {
+ this.definitionsByName = docsumDefinitions.stream()
+ .map(summary -> new DocsumDefinition(summary))
+ .collect(Collectors.toUnmodifiableMap(summary -> summary.name(),
+ summary -> summary));
}
/**
@@ -45,15 +48,15 @@ public final class DocsumDefinitionSet {
* @throws ConfigurationException if the requested summary class is not found and there is none called "default"
*/
public DocsumDefinition getDocsum(String summaryClass) {
+ if (summaryClass == null)
+ summaryClass = "default";
DocsumDefinition ds = definitionsByName.get(summaryClass);
- if (ds == null) {
+ if (ds == null)
ds = definitionsByName.get("default");
- }
- if (ds == null) {
+ if (ds == null)
throw new ConfigurationException("Fetched hit with summary class " + summaryClass +
", but this summary class is not in current summary config (" + this + ")" +
" (that is, you asked for something unknown, and no default was found)");
- }
return ds;
}
@@ -95,7 +98,7 @@ public final class DocsumDefinitionSet {
if (sb.length() != 0) {
sb.append(",");
}
- sb.append("[").append(e.getKey()).append(",").append(e.getValue().getName()).append("]");
+ sb.append("[").append(e.getKey()).append(",").append(e.getValue().name()).append("]");
}
return sb.toString();
}
@@ -104,13 +107,4 @@ public final class DocsumDefinitionSet {
return definitionsByName.size();
}
- private static Collection<DocsumDefinition> toDocsums(DocumentdbInfoConfig.Documentdb config) {
- Collection<DocsumDefinition> docsums = new ArrayList<>();
- for (int i = 0; i < config.summaryclass().size(); ++i)
- docsums.add(new DocsumDefinition(config.summaryclass(i)));
- if (docsums.isEmpty())
- log.warning("No summary classes found in DocumentdbInfoConfig.Documentdb");
- return docsums;
- }
-
}
diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumField.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumField.java
index e412258ff15..e6201a694cb 100644
--- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumField.java
+++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumField.java
@@ -17,7 +17,7 @@ import java.util.logging.Logger;
public abstract class DocsumField {
private static final Logger log = Logger.getLogger(DocsumField.class.getName());
- private static FieldFactory fieldFactory;
+ private static final FieldFactory fieldFactory;
private static class FieldFactory {
@@ -32,8 +32,7 @@ public abstract class DocsumField {
DocsumField create(String typename, String name)
throws InstantiationException, IllegalAccessException,
IllegalArgumentException, InvocationTargetException {
- DocsumField f = constructors.get(typename).newInstance(name);
- return f;
+ return constructors.get(typename).newInstance(name);
}
}
diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocumentDatabase.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocumentDatabase.java
index 67038e0e771..72ccf4aa1dd 100644
--- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocumentDatabase.java
+++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocumentDatabase.java
@@ -2,6 +2,8 @@
package com.yahoo.prelude.fastsearch;
import com.yahoo.search.schema.RankProfile;
+import com.yahoo.search.schema.Schema;
+import com.yahoo.search.schema.SchemaInfo;
import com.yahoo.tensor.TensorType;
import java.util.ArrayList;
@@ -17,48 +19,20 @@ import java.util.stream.Collectors;
*/
public class DocumentDatabase {
- // TODO: What about name conflicts when different search defs have the same rank profile/docsum?
-
public static final String MATCH_PROPERTY = "match";
public static final String SEARCH_DOC_TYPE_KEY = "documentdb.searchdoctype";
- private final String name;
+ private final Schema schema;
private final DocsumDefinitionSet docsumDefSet;
- private final Map<String, RankProfile> rankProfiles;
-
- public DocumentDatabase(DocumentdbInfoConfig.Documentdb documentDb) {
- this(documentDb.name(), new DocsumDefinitionSet(documentDb), toRankProfiles(documentDb.rankprofile()));
+ public DocumentDatabase(Schema schema) {
+ this.schema = schema;
+ this.docsumDefSet = new DocsumDefinitionSet(schema);
}
- public DocumentDatabase(String name, DocsumDefinitionSet docsumDefinitionSet, Collection<RankProfile> rankProfiles) {
- this.name = name;
- this.docsumDefSet = docsumDefinitionSet;
- this.rankProfiles = Map.copyOf(rankProfiles.stream().collect(Collectors.toMap(RankProfile::name, p -> p)));
- }
-
- public String getName() {
- return name;
- }
+ public Schema schema() { return schema; }
- public DocsumDefinitionSet getDocsumDefinitionSet() {
- return docsumDefSet;
- }
-
- /** Returns an unmodifiable map of all the rank profiles in this indexed by rank profile name */
- public Map<String, RankProfile> rankProfiles() { return rankProfiles; }
-
- private static Collection<RankProfile> toRankProfiles(Collection<DocumentdbInfoConfig.Documentdb.Rankprofile> rankProfileConfigList) {
- List<RankProfile> rankProfiles = new ArrayList<>();
- for (var profileConfig : rankProfileConfigList) {
- var builder = new RankProfile.Builder(profileConfig.name());
- builder.setHasSummaryFeatures(profileConfig.hasSummaryFeatures());
- builder.setHasRankFeatures(profileConfig.hasRankFeatures());
- for (var inputConfig : profileConfig.input())
- builder.addInput(inputConfig.name(), TensorType.fromSpec(inputConfig.type()));
- rankProfiles.add(builder.build());
- }
- return rankProfiles;
- }
+ /** Returns the document summary model in this which knows how to convert serialized data to hit fields. */
+ public DocsumDefinitionSet getDocsumDefinitionSet() { return docsumDefSet; }
}
diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java
index 094367dc140..a094be943a2 100644
--- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java
+++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java
@@ -183,7 +183,7 @@ public class FastHit extends Hit {
/** For internal use */
public void addSummary(DocsumDefinition docsumDef, Inspector value) {
if (removedFields != null)
- removedFields.removeAll(docsumDef.fieldNames());
+ removedFields.removeAll(docsumDef.fields().keySet());
if ( ! (summaries instanceof ArrayList) ) summaries = new ArrayList<>(8);
summaries.add(0, new SummaryData(this, docsumDef, value, 1 + summaries.size()));
}
@@ -363,8 +363,8 @@ public class FastHit extends Hit {
@Override
public String toString() {
- return super.toString() + " [fasthit, globalid: " + new GlobalId(globalId).toString() + ", partId: "
- + partId + ", distributionkey: " + distributionKey + "]";
+ return super.toString() + " [fasthit, globalid: " + new GlobalId(globalId).toString() + ", partId: " +
+ partId + ", distributionkey: " + distributionKey + "]";
}
@Override
@@ -562,7 +562,7 @@ public class FastHit extends Hit {
void forEachFieldAsRaw(RawUtf8Consumer consumer) {
data.traverse((ObjectTraverser)(name, value) -> {
if (!shadowed(name) && !removed(name)) {
- DocsumField fieldType = type.getField(name);
+ DocsumField fieldType = type.fields().get(name);
if (fieldType != null) {
if (fieldType.isString()) {
byte[] utf8Value = value.asUtf8();
@@ -592,7 +592,7 @@ public class FastHit extends Hit {
private boolean shadowed(String name) {
if (hit.hasField(name)) return true;
for (int i = 0; i < hit.summaries.size() - index; i++) {
- if (hit.summaries.get(i).type.fieldNames().contains(name))
+ if (hit.summaries.get(i).type.fields().containsKey(name))
return true;
}
return false;
diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java
index 27a45753bb5..33ad8d8c9a8 100644
--- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java
+++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java
@@ -6,6 +6,7 @@ import com.yahoo.prelude.Pong;
import com.yahoo.prelude.querytransform.QueryRewrite;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
+import com.yahoo.search.config.SchemaInfoConfig;
import com.yahoo.search.dispatch.Dispatcher;
import com.yahoo.search.dispatch.FillInvoker;
import com.yahoo.search.dispatch.SearchInvoker;
@@ -15,6 +16,7 @@ import com.yahoo.search.query.Ranking;
import com.yahoo.search.result.ErrorMessage;
import com.yahoo.search.result.Hit;
import com.yahoo.search.result.HitGroup;
+import com.yahoo.search.schema.SchemaInfo;
import com.yahoo.search.searchchain.Execution;
import java.io.IOException;
@@ -51,10 +53,13 @@ public class FastSearcher extends VespaBackEndSearcher {
* @param clusterParams the cluster number, and other cluster backend parameters
* @param documentdbInfoConfig document database parameters
*/
- public FastSearcher(String serverId, Dispatcher dispatcher,
- SummaryParameters docSumParams, ClusterParams clusterParams,
- DocumentdbInfoConfig documentdbInfoConfig) {
- init(serverId, docSumParams, clusterParams, documentdbInfoConfig);
+ public FastSearcher(String serverId,
+ Dispatcher dispatcher,
+ SummaryParameters docSumParams,
+ ClusterParams clusterParams,
+ DocumentdbInfoConfig documentdbInfoConfig,
+ SchemaInfo schemaInfo) {
+ init(serverId, docSumParams, clusterParams, documentdbInfoConfig, schemaInfo);
this.dispatcher = dispatcher;
}
diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/VespaBackEndSearcher.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/VespaBackEndSearcher.java
index 3847e80d3c7..21037be1a8b 100644
--- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/VespaBackEndSearcher.java
+++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/VespaBackEndSearcher.java
@@ -14,10 +14,12 @@ import com.yahoo.protect.Validator;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.cluster.PingableSearcher;
+import com.yahoo.search.config.SchemaInfoConfig;
import com.yahoo.search.schema.RankProfile;
import com.yahoo.search.grouping.vespa.GroupingExecutor;
import com.yahoo.search.result.ErrorMessage;
import com.yahoo.search.result.Hit;
+import com.yahoo.search.schema.SchemaInfo;
import com.yahoo.search.searchchain.Execution;
import com.yahoo.searchlib.aggregation.Grouping;
@@ -107,7 +109,7 @@ public abstract class VespaBackEndSearcher extends PingableSearcher {
if (hasLocation(query.getModel().getQueryTree())) return true;
// Needed to generate ranking features?
- RankProfile rankProfile = documentDb.rankProfiles().get(query.getRanking().getProfile());
+ RankProfile rankProfile = documentDb.schema().rankProfiles().get(query.getRanking().getProfile());
if (rankProfile == null) return true; // stay safe
if (rankProfile.hasSummaryFeatures()) return true;
if (query.getRanking().getListFeatures()) return true;
@@ -133,12 +135,12 @@ public abstract class VespaBackEndSearcher extends PingableSearcher {
private void resolveDocumentDatabase(Query query) {
DocumentDatabase docDb = getDocumentDatabase(query);
if (docDb != null) {
- query.getModel().setDocumentDb(docDb.getName());
+ query.getModel().setDocumentDb(docDb.schema().name());
}
}
public final void init(String serverId, SummaryParameters docSumParams, ClusterParams clusterParams,
- DocumentdbInfoConfig documentdbInfoConfig) {
+ DocumentdbInfoConfig documentdbInfoConfig, SchemaInfo schemaInfo) {
this.serverId = serverId;
this.name = clusterParams.searcherName;
@@ -148,10 +150,9 @@ public abstract class VespaBackEndSearcher extends PingableSearcher {
if (documentdbInfoConfig != null) {
for (DocumentdbInfoConfig.Documentdb docDb : documentdbInfoConfig.documentdb()) {
- DocumentDatabase db = new DocumentDatabase(docDb);
- if (documentDbs.isEmpty()) {
+ DocumentDatabase db = new DocumentDatabase(schemaInfo.schemas().get(docDb.name()));
+ if (documentDbs.isEmpty())
defaultDocumentDb = db;
- }
documentDbs.put(docDb.name(), db);
}
}
@@ -159,6 +160,7 @@ public abstract class VespaBackEndSearcher extends PingableSearcher {
protected void transformQuery(Query query) { }
+ @Override
public Result search(Query query, Execution execution) {
// query root should not be null here
Item root = query.getModel().getQueryTree().getRoot();
@@ -391,7 +393,7 @@ public abstract class VespaBackEndSearcher extends PingableSearcher {
private String decodeSummary(String summaryClass, FastHit hit, byte[] docsumdata) {
DocumentDatabase db = getDocumentDatabase(hit.getQuery());
- hit.setField(Hit.SDDOCNAME_FIELD, db.getName());
+ hit.setField(Hit.SDDOCNAME_FIELD, db.schema().name());
return decodeSummary(summaryClass, hit, docsumdata, db.getDocsumDefinitionSet());
}
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcProtobufFillInvoker.java b/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcProtobufFillInvoker.java
index 7a5ef94069d..57f7ea34a97 100644
--- a/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcProtobufFillInvoker.java
+++ b/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcProtobufFillInvoker.java
@@ -215,7 +215,7 @@ public class RpcProtobufFillInvoker extends FillInvoker {
for (int i = 0; i < hits.size(); i++) {
Inspector summary = summaries.entry(i).field("docsum");
if (summary.valid()) {
- hits.get(i).setField(Hit.SDDOCNAME_FIELD, documentDb.getName());
+ hits.get(i).setField(Hit.SDDOCNAME_FIELD, documentDb.schema().name());
hits.get(i).addSummary(documentDb.getDocsumDefinitionSet().getDocsum(summaryClass), summary);
hits.get(i).setFilled(summaryClass);
} else {
diff --git a/container-search/src/main/java/com/yahoo/search/schema/DocumentSummary.java b/container-search/src/main/java/com/yahoo/search/schema/DocumentSummary.java
new file mode 100644
index 00000000000..12037ee6633
--- /dev/null
+++ b/container-search/src/main/java/com/yahoo/search/schema/DocumentSummary.java
@@ -0,0 +1,160 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.search.schema;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * A document summary definition: Defines the schema on which a document hit may be
+ * represented in a Result.
+ *
+ * @author bratseth
+ */
+public class DocumentSummary {
+
+ private final String name;
+ private final List<Field> fields;
+ private final boolean dynamic;
+
+ private DocumentSummary(Builder builder) {
+ this.name = builder.name;
+ this.fields = List.copyOf(builder.fields);
+ this.dynamic = builder.dynamic;
+ }
+
+ public String name() { return name; }
+ public List<Field> fields() { return fields; }
+
+ /** Returns whether this contains fields which are generated dynamically from the query and field data. */
+ public boolean isDynamic() { return dynamic; }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if ( ! (o instanceof DocumentSummary)) return false;
+ var other = (DocumentSummary)o;
+ if ( ! other.name.equals(this.name)) return false;
+ if ( other.dynamic != this.dynamic) return false;
+ if ( ! other.fields.equals(this.fields)) return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(name, dynamic, fields);
+ }
+
+ @Override
+ public String toString() {
+ return "document summary '" + name + "'";
+ }
+
+ public static class Builder {
+
+ private final String name;
+ private final List<Field> fields = new ArrayList<>();
+ private boolean dynamic;
+
+ public Builder(String name) {
+ this.name = name;
+ }
+
+ public Builder add(Field field) {
+ fields.add(field);
+ return this;
+ }
+
+ public Builder setDynamic(boolean dynamic) {
+ this.dynamic = dynamic;
+ return this;
+ }
+
+ public DocumentSummary build() { return new DocumentSummary(this); }
+
+ }
+
+ public static class Field {
+
+ public enum Type {
+ bool,
+ byteType("byte"),
+ shortType("short"),
+ integer,
+ int64,
+ float16,
+ floatType("float"),
+ doubleType("double"),
+ string,
+ data,
+ raw,
+ longstring,
+ longdata,
+ jsonstring,
+ featuredata,
+ xmlstring,
+ tensor;
+
+ private final String name;
+
+ Type() {
+ this(null);
+ }
+
+ Type(String name) {
+ this.name = name;
+ }
+
+ /** Use this, not name() to retrieve the string value of this. */
+ public String asString() {
+ return name != null ? name : name();
+ }
+
+ @Override
+ public String toString() { return asString(); }
+
+ public static Type fromString(String name) {
+ return Arrays.stream(Type.values()).filter(t -> name.equals(t.asString())).findAny().orElseThrow();
+ }
+
+ }
+
+ private final String name;
+ private final Type type;
+
+ public Field(String name, String type) {
+ this(name, Type.fromString(type));
+ }
+
+ public Field(String name, Type type) {
+ this.name = name;
+ this.type = type;
+ }
+
+ public String name() { return name; }
+ public Type type() { return type; }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if ( ! (o instanceof Field)) return false;
+ var other = (Field)o;
+ if ( ! other.name.equals(this.name)) return false;
+ if ( other.type != this.type) return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(name, type);
+ }
+
+ @Override
+ public String toString() {
+ return "summary field '" + name + "' " + type;
+ }
+
+ }
+
+}
diff --git a/container-search/src/main/java/com/yahoo/search/schema/RankProfile.java b/container-search/src/main/java/com/yahoo/search/schema/RankProfile.java
index 8267e5c937b..39d4a389e6f 100644
--- a/container-search/src/main/java/com/yahoo/search/schema/RankProfile.java
+++ b/container-search/src/main/java/com/yahoo/search/schema/RankProfile.java
@@ -3,7 +3,9 @@ package com.yahoo.search.schema;
import com.yahoo.tensor.TensorType;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
@@ -23,7 +25,7 @@ public class RankProfile {
this.name = builder.name;
this.hasSummaryFeatures = builder.hasSummaryFeatures;
this.hasRankFeatures = builder.hasRankFeatures;
- this.inputs = Map.copyOf(builder.inputs);
+ this.inputs = Collections.unmodifiableMap(builder.inputs);
}
public String name() { return name; }
@@ -64,7 +66,7 @@ public class RankProfile {
private final String name;
private boolean hasSummaryFeatures = true;
private boolean hasRankFeatures = true;
- private final Map<String, TensorType> inputs = new HashMap<>();
+ private final Map<String, TensorType> inputs = new LinkedHashMap<>();
public Builder(String name) {
this.name = Objects.requireNonNull(name);
diff --git a/container-search/src/main/java/com/yahoo/search/schema/Schema.java b/container-search/src/main/java/com/yahoo/search/schema/Schema.java
index b66e6ce957a..2ab5a30fbd7 100644
--- a/container-search/src/main/java/com/yahoo/search/schema/Schema.java
+++ b/container-search/src/main/java/com/yahoo/search/schema/Schema.java
@@ -3,7 +3,9 @@ package com.yahoo.search.schema;
import com.yahoo.api.annotations.Beta;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
@@ -19,14 +21,17 @@ public class Schema {
private final String name;
private final Map<String, RankProfile> rankProfiles;
+ private final Map<String, DocumentSummary> documentSummaries;
private Schema(Builder builder) {
this.name = builder.name;
- this.rankProfiles = Map.copyOf(builder.rankProfiles);
+ this.rankProfiles = Collections.unmodifiableMap(builder.rankProfiles);
+ this.documentSummaries = Collections.unmodifiableMap(builder.documentSummaries);
}
public String name() { return name; }
public Map<String, RankProfile> rankProfiles() { return rankProfiles; }
+ public Map<String, DocumentSummary> documentSummaries() { return documentSummaries; }
@Override
public boolean equals(Object o) {
@@ -35,12 +40,13 @@ public class Schema {
Schema other = (Schema)o;
if ( ! other.name.equals(this.name)) return false;
if ( ! other.rankProfiles.equals(this.rankProfiles)) return false;
+ if ( ! other.documentSummaries.equals(this.documentSummaries)) return false;
return true;
}
@Override
public int hashCode() {
- return Objects.hash(name, rankProfiles);
+ return Objects.hash(name, rankProfiles, documentSummaries);
}
@Override
@@ -51,14 +57,20 @@ public class Schema {
public static class Builder {
private final String name;
- private final Map<String, RankProfile> rankProfiles = new HashMap<>();
+ private final Map<String, RankProfile> rankProfiles = new LinkedHashMap<>();
+ private final Map<String, DocumentSummary> documentSummaries = new LinkedHashMap<>();
public Builder(String name) {
this.name = Objects.requireNonNull(name);
}
public Builder add(RankProfile profile) {
- rankProfiles.put(profile.name(), Objects.requireNonNull(profile));
+ rankProfiles.put(profile.name(), profile);
+ return this;
+ }
+
+ public Builder add(DocumentSummary documentSummary) {
+ documentSummaries.put(documentSummary.name(), documentSummary);
return this;
}
diff --git a/container-search/src/main/java/com/yahoo/search/schema/SchemaInfo.java b/container-search/src/main/java/com/yahoo/search/schema/SchemaInfo.java
index 4daf110fc54..7bd66445512 100644
--- a/container-search/src/main/java/com/yahoo/search/schema/SchemaInfo.java
+++ b/container-search/src/main/java/com/yahoo/search/schema/SchemaInfo.java
@@ -2,13 +2,17 @@
package com.yahoo.search.schema;
import com.yahoo.api.annotations.Beta;
+import com.yahoo.component.annotation.Inject;
import com.yahoo.container.QrSearchersConfig;
import com.yahoo.search.Query;
import com.yahoo.search.config.IndexInfoConfig;
import com.yahoo.search.config.SchemaInfoConfig;
import com.yahoo.tensor.TensorType;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -39,11 +43,12 @@ public class SchemaInfo {
private static final SchemaInfo empty = new SchemaInfo(List.of(), Map.of());
- private final List<Schema> schemas;
+ private final Map<String, Schema> schemas;
/** The schemas contained in each content cluster indexed by cluster name */
private final Map<String, List<String>> clusters;
+ @Inject
public SchemaInfo(IndexInfoConfig indexInfo, // will be used in the future
SchemaInfoConfig schemaInfoConfig,
QrSearchersConfig qrSearchersConfig) {
@@ -51,12 +56,14 @@ public class SchemaInfo {
}
public SchemaInfo(List<Schema> schemas, Map<String, List<String>> clusters) {
- this.schemas = List.copyOf(schemas);
- this.clusters = Map.copyOf(clusters);
+ Map<String, Schema> schemaMap = new LinkedHashMap<>();
+ schemas.forEach(schema -> schemaMap.put(schema.name(), schema));
+ this.schemas = Collections.unmodifiableMap(schemaMap);
+ this.clusters = Collections.unmodifiableMap(clusters);
}
- /** Returns all schemas configured in this application. */
- public List<Schema> schemas() { return schemas; }
+ /** Returns all schemas configured in this application, indexed by schema name. */
+ public Map<String, Schema> schemas() { return schemas; }
public Session newSession(Query query) {
return new Session(query.getModel().getSources(), query.getModel().getRestrict(), clusters, schemas);
@@ -80,13 +87,13 @@ public class SchemaInfo {
/** The schema information resolved to be relevant to this session. */
public static class Session {
- private final List<Schema> schemas;
+ private final Collection<Schema> schemas;
private Session(Set<String> sources,
Set<String> restrict,
Map<String, List<String>> clusters,
- List<Schema> candidates) {
- this.schemas = resolveSchemas(sources, restrict, clusters, candidates);
+ Map<String, Schema> candidates) {
+ this.schemas = resolveSchemas(sources, restrict, clusters, candidates.values());
}
/**
@@ -96,10 +103,10 @@ public class SchemaInfo {
*
* @return the possibly empty list of schemas matching the arguments
*/
- private static List<Schema> resolveSchemas(Set<String> sources,
- Set<String> restrict,
- Map<String, List<String>> clusters,
- List<Schema> candidates) {
+ private static Collection<Schema> resolveSchemas(Set<String> sources,
+ Set<String> restrict,
+ Map<String, List<String>> clusters,
+ Collection<Schema> candidates) {
if (sources.isEmpty())
return restrict.isEmpty() ? candidates : keep(restrict, candidates);
@@ -114,7 +121,7 @@ public class SchemaInfo {
return restrict.isEmpty() ? candidates : keep(restrict, candidates);
}
- private static List<Schema> keep(Set<String> names, List<Schema> schemas) {
+ private static List<Schema> keep(Set<String> names, Collection<Schema> schemas) {
return schemas.stream().filter(schema -> names.contains(schema.name())).collect(Collectors.toList());
}
diff --git a/container-search/src/main/java/com/yahoo/search/schema/SchemaInfoConfigurer.java b/container-search/src/main/java/com/yahoo/search/schema/SchemaInfoConfigurer.java
index 84ed9ae8e3d..c5a74ece866 100644
--- a/container-search/src/main/java/com/yahoo/search/schema/SchemaInfoConfigurer.java
+++ b/container-search/src/main/java/com/yahoo/search/schema/SchemaInfoConfigurer.java
@@ -1,11 +1,17 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.schema;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
import com.yahoo.container.QrSearchersConfig;
+import com.yahoo.prelude.fastsearch.DocsumDefinition;
+import com.yahoo.prelude.fastsearch.DocsumField;
+import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig;
import com.yahoo.search.config.SchemaInfoConfig;
import com.yahoo.tensor.TensorType;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -24,6 +30,7 @@ class SchemaInfoConfigurer {
static Schema toSchema(SchemaInfoConfig.Schema schemaInfoConfig) {
Schema.Builder builder = new Schema.Builder(schemaInfoConfig.name());
+
for (var profileConfig : schemaInfoConfig.rankprofile()) {
RankProfile.Builder profileBuilder = new RankProfile.Builder(profileConfig.name());
profileBuilder.setHasSummaryFeatures(profileConfig.hasSummaryFeatures());
@@ -32,6 +39,17 @@ class SchemaInfoConfigurer {
profileBuilder.addInput(inputConfig.name(), TensorType.fromSpec(inputConfig.type()));
builder.add(profileBuilder.build());
}
+
+ for (var summaryConfig : schemaInfoConfig.summaryclass()) {
+ DocumentSummary.Builder summaryBuilder = new DocumentSummary.Builder(summaryConfig.name());
+ for (var field : summaryConfig.fields()) {
+ if (field.dynamic())
+ summaryBuilder.setDynamic(true);
+ summaryBuilder.add(new DocumentSummary.Field(field.name(), field.type()));
+ }
+ builder.add(summaryBuilder.build());
+ }
+
return builder.build();
}
diff --git a/container-search/src/main/java/com/yahoo/search/searchchain/ExecutionFactory.java b/container-search/src/main/java/com/yahoo/search/searchchain/ExecutionFactory.java
index 3e44b02618e..bf8ef39001f 100644
--- a/container-search/src/main/java/com/yahoo/search/searchchain/ExecutionFactory.java
+++ b/container-search/src/main/java/com/yahoo/search/searchchain/ExecutionFactory.java
@@ -2,6 +2,7 @@
package com.yahoo.search.searchchain;
import com.google.inject.Inject;
+import com.yahoo.api.annotations.Beta;
import com.yahoo.component.AbstractComponent;
import com.yahoo.component.chain.Chain;
import com.yahoo.component.chain.ChainsConfigurer;
@@ -48,6 +49,8 @@ public class ExecutionFactory extends AbstractComponent {
private final RendererRegistry rendererRegistry;
private final Executor executor;
+ // TODO: Fix tests depending on HandlersConfigurerTestWrapper so that this constructor can be removed
+ @Beta
@Inject
public ExecutionFactory(ChainsConfig chainsConfig,
IndexInfoConfig indexInfo,
@@ -58,9 +61,29 @@ public class ExecutionFactory extends AbstractComponent {
Linguistics linguistics,
ComponentRegistry<Renderer> renderers,
Executor executor) {
+ this(chainsConfig,
+ indexInfo,
+ new SchemaInfo(indexInfo, schemaInfo, clusters),
+ clusters,
+ searchers,
+ specialTokens,
+ linguistics,
+ renderers,
+ executor);
+ }
+
+ public ExecutionFactory(ChainsConfig chainsConfig,
+ IndexInfoConfig indexInfo,
+ SchemaInfo schemaInfo,
+ QrSearchersConfig clusters,
+ ComponentRegistry<Searcher> searchers,
+ SpecialtokensConfig specialTokens,
+ Linguistics linguistics,
+ ComponentRegistry<Renderer> renderers,
+ Executor executor) {
this.searchChainRegistry = createSearchChainRegistry(searchers, chainsConfig);
this.indexFacts = new IndexFacts(new IndexModel(indexInfo, clusters)).freeze();
- this.schemaInfo = new SchemaInfo(indexInfo, schemaInfo, clusters);
+ this.schemaInfo = schemaInfo;
this.specialTokens = new SpecialTokenRegistry(specialTokens);
this.linguistics = linguistics;
this.renderingExecutor = createRenderingExecutor();
@@ -78,7 +101,7 @@ public class ExecutionFactory extends AbstractComponent {
Linguistics linguistics,
ComponentRegistry<Renderer> renderers,
Executor executor) {
- this(chainsConfig, indexInfo, new SchemaInfoConfig.Builder().build(), clusters, searchers, specialTokens, linguistics, renderers, executor);
+ this(chainsConfig, indexInfo, SchemaInfo.empty(), clusters, searchers, specialTokens, linguistics, renderers, executor);
}
/** @deprecated pass the container threadpool */
@@ -90,7 +113,7 @@ public class ExecutionFactory extends AbstractComponent {
SpecialtokensConfig specialTokens,
Linguistics linguistics,
ComponentRegistry<Renderer> renderers) {
- this(chainsConfig, indexInfo, new SchemaInfoConfig.Builder().build(), clusters, searchers, specialTokens, linguistics, renderers, null);
+ this(chainsConfig, indexInfo, SchemaInfo.empty(), clusters, searchers, specialTokens, linguistics, renderers, null);
}
private SearchChainRegistry createSearchChainRegistry(ComponentRegistry<Searcher> searchers,
@@ -144,7 +167,7 @@ public class ExecutionFactory extends AbstractComponent {
public static ExecutionFactory empty() {
return new ExecutionFactory(new ChainsConfig.Builder().build(),
new IndexInfoConfig.Builder().build(),
- new SchemaInfoConfig.Builder().build(),
+ SchemaInfo.empty(),
new QrSearchersConfig.Builder().build(),
new ComponentRegistry<>(),
new SpecialtokensConfig.Builder().build(),
diff --git a/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
index 2d62e4c0154..434f4bcc8e0 100644
--- a/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
@@ -522,6 +522,7 @@ public class ClusterSearcherTestCase {
DocumentdbInfoConfig.Builder documentDbConfig = new DocumentdbInfoConfig.Builder();
documentDbConfig.documentdb(new DocumentdbInfoConfig.Documentdb.Builder().name("type1"));
+ var schema = new Schema.Builder("type1");
DispatchConfig dispatchConfig = new DispatchConfig.Builder().build();
Dispatcher dispatcher = new Dispatcher(new RpcResourcePool(dispatchConfig),
@@ -537,6 +538,7 @@ public class ClusterSearcherTestCase {
qrSearchersConfig.build(),
clusterConfig.build(),
documentDbConfig.build(),
+ new SchemaInfo(List.of(schema.build()), Map.of()),
dispatchers,
vipStatus,
null);
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/SlimeSummaryTestCase.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/SlimeSummaryTestCase.java
index 8b21d1e03b2..a174bde3902 100644
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/SlimeSummaryTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/fastsearch/SlimeSummaryTestCase.java
@@ -10,6 +10,8 @@ import com.yahoo.prelude.hitfield.XMLString;
import com.yahoo.search.result.FeatureData;
import com.yahoo.search.result.Hit;
import com.yahoo.search.result.StructuredData;
+import com.yahoo.search.schema.DocumentSummary;
+import com.yahoo.search.schema.Schema;
import com.yahoo.slime.BinaryFormat;
import com.yahoo.slime.Cursor;
import com.yahoo.slime.Slime;
@@ -43,7 +45,7 @@ public class SlimeSummaryTestCase {
@Test
public void testDecodingEmpty() {
- DocsumDefinitionSet docsum = createDocsumDefinitionSet(summary_cf);
+ DocsumDefinitionSet docsum = createDocsumDefinitionSet();
FastHit hit = new FastHit();
assertNull(docsum.lazyDecode("default", emptySummary(), hit));
assertNull(hit.getField("integer_field"));
@@ -69,7 +71,7 @@ public class SlimeSummaryTestCase {
@Test
public void testTimeout() {
- DocsumDefinitionSet docsum = createDocsumDefinitionSet(summary_cf);
+ DocsumDefinitionSet docsum = createDocsumDefinitionSet();
FastHit hit = new FastHit();
assertEquals("Hit hit index:null/0/000000000000000000000000 (relevance 0.0) [fasthit, globalid: 0 0 0 0 0 0 0 0 0 0 0 0, partId: 0, distributionkey: 0] failed: Timed out....",
docsum.lazyDecode("default", timeoutSummary(), hit));
@@ -79,7 +81,7 @@ public class SlimeSummaryTestCase {
public void testDecoding() {
Tensor tensor1 = Tensor.from("tensor(x{},y{}):{{x:foo,y:bar}:0.1}");
Tensor tensor2 = Tensor.from("tensor(x[1],y[1]):{{x:0,y:0}:-0.3}");
- DocsumDefinitionSet docsum = createDocsumDefinitionSet(summary_cf);
+ DocsumDefinitionSet docsum = createDocsumDefinitionSet();
FastHit hit = new FastHit();
assertNull(docsum.lazyDecode("default", fullSummary(tensor1, tensor2), hit));
assertEquals(4, hit.getField("integer_field"));
@@ -127,10 +129,10 @@ public class SlimeSummaryTestCase {
@Test
public void testFieldAccessAPI() {
- DocsumDefinitionSet partialDocsum1 = createDocsumDefinitionSet(partial_summary1_cf);
- DocsumDefinitionSet partialDocsum2 = createDocsumDefinitionSet(partial_summary2_cf);
- DocsumDefinitionSet partialDocsum3 = createDocsumDefinitionSet(partial_summary3_cf);
- DocsumDefinitionSet fullDocsum = createDocsumDefinitionSet(summary_cf);
+ DocsumDefinitionSet partialDocsum1 = createPartialDocsumDefinitionSet1();
+ DocsumDefinitionSet partialDocsum2 = createPartialDocsumDefinitionSet2();
+ DocsumDefinitionSet partialDocsum3 = createPartialDocsumDefinitionSet3();
+ DocsumDefinitionSet fullDocsum = createDocsumDefinitionSet();
FastHit hit = new FastHit();
Map<String, Object> expected = new HashMap<>();
@@ -437,14 +439,59 @@ public class SlimeSummaryTestCase {
return buf.array();
}
- private DocsumDefinitionSet createDocsumDefinitionSet(String configID) {
- DocumentdbInfoConfig config = new ConfigGetter<>(DocumentdbInfoConfig.class).getConfig(configID);
- return new DocsumDefinitionSet(config.documentdb(0));
+ private DocsumDefinitionSet createDocsumDefinitionSet() {
+ var schema = new Schema.Builder("test");
+ var summary = new DocumentSummary.Builder("default");
+ summary.add(new DocumentSummary.Field("integer_field", "integer"));
+ summary.add(new DocumentSummary.Field("short_field", "short"));
+ summary.add(new DocumentSummary.Field("byte_field", "byte"));
+ summary.add(new DocumentSummary.Field("float_field", "float"));
+ summary.add(new DocumentSummary.Field("double_field", "double"));
+ summary.add(new DocumentSummary.Field("int64_field", "int64"));
+ summary.add(new DocumentSummary.Field("string_field", "string"));
+ summary.add(new DocumentSummary.Field("data_field", "data"));
+ summary.add(new DocumentSummary.Field("longstring_field", "longstring"));
+ summary.add(new DocumentSummary.Field("longdata_field", "longdata"));
+ summary.add(new DocumentSummary.Field("xmlstring_field", "xmlstring"));
+ summary.add(new DocumentSummary.Field("jsonstring_field", "jsonstring"));
+ summary.add(new DocumentSummary.Field("tensor_field1", "tensor"));
+ summary.add(new DocumentSummary.Field("tensor_field2", "tensor"));
+ summary.add(new DocumentSummary.Field("summaryfeatures", "featuredata"));
+ schema.add(summary.build());
+ return new DocsumDefinitionSet(schema.build());
+ }
+
+ private DocsumDefinitionSet createPartialDocsumDefinitionSet1() {
+ var schema = new Schema.Builder("test");
+ var summary = new DocumentSummary.Builder("default");
+ summary.add(new DocumentSummary.Field("integer_field", "integer"));
+ summary.add(new DocumentSummary.Field("short_field", "short"));
+ schema.add(summary.build());
+ return new DocsumDefinitionSet(schema.build());
+ }
+
+ private DocsumDefinitionSet createPartialDocsumDefinitionSet2() {
+ var schema = new Schema.Builder("test");
+ var summary = new DocumentSummary.Builder("default");
+ summary.add(new DocumentSummary.Field("integer_field", "integer"));
+ summary.add(new DocumentSummary.Field("float_field", "float"));
+ summary.add(new DocumentSummary.Field("double_field", "double"));
+ schema.add(summary.build());
+ return new DocsumDefinitionSet(schema.build());
+ }
+
+ private DocsumDefinitionSet createPartialDocsumDefinitionSet3() {
+ var schema = new Schema.Builder("test");
+ var summary = new DocumentSummary.Builder("default");
+ summary.add(new DocumentSummary.Field("integer_field", "integer"));
+ summary.add(new DocumentSummary.Field("string_field", "string"));
+ schema.add(summary.build());
+ return new DocsumDefinitionSet(schema.build());
}
private static class Utf8FieldTraverser implements Hit.RawUtf8Consumer {
- private Map<String, Object> traversed;
+ private final Map<String, Object> traversed;
public Utf8FieldTraverser(Map<String, Object> traversed) {
this.traversed = traversed;
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/partial-summary1.cfg b/container-search/src/test/java/com/yahoo/prelude/fastsearch/partial-summary1.cfg
deleted file mode 100644
index 5aa5c84d936..00000000000
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/partial-summary1.cfg
+++ /dev/null
@@ -1,10 +0,0 @@
-documentdb[1]
-documentdb[0].name test
-documentdb[0].summaryclass[1]
-documentdb[0].summaryclass[0].name default
-documentdb[0].summaryclass[0].id 1
-documentdb[0].summaryclass[0].fields[2]
-documentdb[0].summaryclass[0].fields[0].name integer_field
-documentdb[0].summaryclass[0].fields[0].type integer
-documentdb[0].summaryclass[0].fields[1].name short_field
-documentdb[0].summaryclass[0].fields[1].type short
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/partial-summary2.cfg b/container-search/src/test/java/com/yahoo/prelude/fastsearch/partial-summary2.cfg
deleted file mode 100644
index bc870a63d66..00000000000
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/partial-summary2.cfg
+++ /dev/null
@@ -1,12 +0,0 @@
-documentdb[1]
-documentdb[0].name test
-documentdb[0].summaryclass[1]
-documentdb[0].summaryclass[0].name default
-documentdb[0].summaryclass[0].id 2
-documentdb[0].summaryclass[0].fields[3]
-documentdb[0].summaryclass[0].fields[0].name integer_field
-documentdb[0].summaryclass[0].fields[0].type integer
-documentdb[0].summaryclass[0].fields[1].name float_field
-documentdb[0].summaryclass[0].fields[1].type float
-documentdb[0].summaryclass[0].fields[2].name double_field
-documentdb[0].summaryclass[0].fields[2].type double
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/partial-summary3.cfg b/container-search/src/test/java/com/yahoo/prelude/fastsearch/partial-summary3.cfg
deleted file mode 100644
index 5d7319fd393..00000000000
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/partial-summary3.cfg
+++ /dev/null
@@ -1,10 +0,0 @@
-documentdb[1]
-documentdb[0].name test
-documentdb[0].summaryclass[1]
-documentdb[0].summaryclass[0].name partial3
-documentdb[0].summaryclass[0].id 3
-documentdb[0].summaryclass[0].fields[3]
-documentdb[0].summaryclass[0].fields[0].name integer_field
-documentdb[0].summaryclass[0].fields[0].type integer
-documentdb[0].summaryclass[0].fields[1].name string_field
-documentdb[0].summaryclass[0].fields[1].type string
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/summary.cfg b/container-search/src/test/java/com/yahoo/prelude/fastsearch/summary.cfg
deleted file mode 100644
index e074eadcbc2..00000000000
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/summary.cfg
+++ /dev/null
@@ -1,36 +0,0 @@
-documentdb[1]
-documentdb[0].name test
-documentdb[0].summaryclass[1]
-documentdb[0].summaryclass[0].name default
-documentdb[0].summaryclass[0].id 0
-documentdb[0].summaryclass[0].fields[15]
-documentdb[0].summaryclass[0].fields[0].name integer_field
-documentdb[0].summaryclass[0].fields[0].type integer
-documentdb[0].summaryclass[0].fields[1].name short_field
-documentdb[0].summaryclass[0].fields[1].type short
-documentdb[0].summaryclass[0].fields[2].name byte_field
-documentdb[0].summaryclass[0].fields[2].type byte
-documentdb[0].summaryclass[0].fields[3].name float_field
-documentdb[0].summaryclass[0].fields[3].type float
-documentdb[0].summaryclass[0].fields[4].name double_field
-documentdb[0].summaryclass[0].fields[4].type double
-documentdb[0].summaryclass[0].fields[5].name int64_field
-documentdb[0].summaryclass[0].fields[5].type int64
-documentdb[0].summaryclass[0].fields[6].name string_field
-documentdb[0].summaryclass[0].fields[6].type string
-documentdb[0].summaryclass[0].fields[7].name data_field
-documentdb[0].summaryclass[0].fields[7].type data
-documentdb[0].summaryclass[0].fields[8].name longstring_field
-documentdb[0].summaryclass[0].fields[8].type longstring
-documentdb[0].summaryclass[0].fields[9].name longdata_field
-documentdb[0].summaryclass[0].fields[9].type longdata
-documentdb[0].summaryclass[0].fields[10].name xmlstring_field
-documentdb[0].summaryclass[0].fields[10].type xmlstring
-documentdb[0].summaryclass[0].fields[11].name jsonstring_field
-documentdb[0].summaryclass[0].fields[11].type jsonstring
-documentdb[0].summaryclass[0].fields[12].name tensor_field1
-documentdb[0].summaryclass[0].fields[12].type tensor
-documentdb[0].summaryclass[0].fields[13].name tensor_field2
-documentdb[0].summaryclass[0].fields[13].type tensor
-documentdb[0].summaryclass[0].fields[14].name summaryfeatures
-documentdb[0].summaryclass[0].fields[14].type featuredata
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/DocsumDefinitionTestCase.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/DocsumDefinitionTestCase.java
index 6921880d725..da9d849db90 100644
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/DocsumDefinitionTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/DocsumDefinitionTestCase.java
@@ -1,8 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.fastsearch.test;
-import com.yahoo.config.subscription.ConfigGetter;
-import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig;
import com.yahoo.prelude.fastsearch.ByteField;
import com.yahoo.prelude.fastsearch.DataField;
import com.yahoo.prelude.fastsearch.DocsumDefinition;
@@ -12,6 +10,8 @@ import com.yahoo.prelude.fastsearch.IntegerField;
import com.yahoo.prelude.fastsearch.StringField;
import com.yahoo.document.DocumentId;
import com.yahoo.document.GlobalId;
+import com.yahoo.search.schema.DocumentSummary;
+import com.yahoo.search.schema.Schema;
import com.yahoo.slime.BinaryFormat;
import com.yahoo.slime.Cursor;
import com.yahoo.slime.Slime;
@@ -21,9 +21,8 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
/**
@@ -34,37 +33,8 @@ import static org.junit.Assert.assertTrue;
public class DocsumDefinitionTestCase {
@Test
- public void testReading() {
- String summary_cf = "file:src/test/java/com/yahoo/prelude/fastsearch/test/documentdb-info.cfg";
- DocsumDefinitionSet set = createDocsumDefinitionSet(summary_cf);
-
- String[] defs = new String[] { "[default,default]", "[version1,version1]",
- "[withranklog,withranklog]", "[version2,version2]", "[version3,version3]",
- "[version4,version4]", "[version5,version5]" };
- String setAsString = set.toString();
- for (String d : defs) {
- assertFalse(setAsString.indexOf(d) == -1);
- }
- assertEquals(7, set.size());
-
- DocsumDefinition docsum0 = set.getDocsum("default");
-
- assertNotNull(docsum0);
- assertEquals("default", docsum0.getName());
- assertEquals(19, docsum0.getFieldCount());
- assertNull(docsum0.getField(19));
- assertEquals("DSHOST", docsum0.getField(7).getName());
-
- assertTrue(docsum0.getField(1) instanceof StringField);
- assertTrue(docsum0.getField(6) instanceof ByteField);
- assertTrue(docsum0.getField(7) instanceof IntegerField);
- assertTrue(docsum0.getField(18) instanceof DataField);
- }
-
- @Test
public void testDecoding() {
- String summary_cf = "file:src/test/java/com/yahoo/prelude/fastsearch/test/documentdb-info.cfg";
- DocsumDefinitionSet set = createDocsumDefinitionSet(summary_cf);
+ DocsumDefinitionSet set = createDocsumDefinitionSet();
FastHit hit = new FastHit();
set.lazyDecode(null, makeDocsum(), hit);
@@ -87,10 +57,6 @@ public class DocsumDefinitionTestCase {
return sb.toString();
}
- public static GlobalId createGlobalId(int docId) {
- return new GlobalId((new DocumentId("id:ns:type::" + docId)).getGlobalId());
- }
-
public static byte[] makeDocsum() {
Slime slime = new Slime();
Cursor docsum = slime.setObject();
@@ -110,9 +76,18 @@ public class DocsumDefinitionTestCase {
return buf.array();
}
- public static DocsumDefinitionSet createDocsumDefinitionSet(String configID) {
- DocumentdbInfoConfig config = new ConfigGetter<>(DocumentdbInfoConfig.class).getConfig(configID);
- return new DocsumDefinitionSet(config.documentdb(0));
+ public static DocsumDefinitionSet createDocsumDefinitionSet() {
+ var schema = new Schema.Builder("test");
+ var summary = new DocumentSummary.Builder("default");
+ summary.add(new DocumentSummary.Field("TOPIC", "string"));
+ summary.add(new DocumentSummary.Field("TITLE", "string"));
+ summary.add(new DocumentSummary.Field("DYNTEASER", "string"));
+ summary.add(new DocumentSummary.Field("EXTINFOSOURCE", "integer"));
+ summary.add(new DocumentSummary.Field("LANG1", "integer"));
+ summary.add(new DocumentSummary.Field("WORDS", "integer"));
+ summary.add(new DocumentSummary.Field("BYTES", "byte"));
+ schema.add(summary.build());
+ return new DocsumDefinitionSet(schema.build());
}
}
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java
index da93e0e845b..c9193d08381 100644
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java
@@ -24,12 +24,17 @@ import com.yahoo.search.grouping.request.EachOperation;
import com.yahoo.search.grouping.request.GroupingOperation;
import com.yahoo.search.rendering.RendererRegistry;
import com.yahoo.search.result.ErrorMessage;
+import com.yahoo.search.schema.DocumentSummary;
+import com.yahoo.search.schema.RankProfile;
+import com.yahoo.search.schema.Schema;
+import com.yahoo.search.schema.SchemaInfo;
import com.yahoo.search.searchchain.Execution;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -56,7 +61,8 @@ public class FastSearcherTestCase {
MockDispatcher.create(Collections.emptyList()),
new SummaryParameters(null),
new ClusterParams("testhittype"),
- documentdbInfoConfig);
+ documentdbInfoConfig,
+ SchemaInfo.empty());
String query = "?junkparam=ignored";
Result result = doSearch(fastSearcher,new Query(query), 0, 10);
@@ -90,7 +96,8 @@ public class FastSearcherTestCase {
MockDispatcher.create(Collections.singletonList(new Node(0, "host0", 0))),
new SummaryParameters(null),
new ClusterParams("testhittype"),
- documentdbInfoConfig);
+ documentdbInfoConfig,
+ SchemaInfo.empty());
Query q = new Query("?query=foo");
GroupingRequest request1 = GroupingRequest.newInstance(q);
request1.setRootOperation(new AllOperation());
@@ -108,13 +115,18 @@ public class FastSearcherTestCase {
@Test
public void testSummaryNeedsQuery() {
- ConfigGetter<DocumentdbInfoConfig> getter = new ConfigGetter<>(DocumentdbInfoConfig.class);
- DocumentdbInfoConfig config = getter.getConfig("file:src/test/java/com/yahoo/prelude/fastsearch/test/documentdb-info.cfg");
+ var documentDb = new DocumentdbInfoConfig(new DocumentdbInfoConfig.Builder().documentdb(new DocumentdbInfoConfig.Documentdb.Builder().name("test")));
+ var schema = new Schema.Builder("test")
+ .add(new DocumentSummary.Builder("default").build())
+ .add(new RankProfile.Builder("default").setHasRankFeatures(false)
+ .setHasSummaryFeatures(false)
+ .build());
FastSearcher backend = new FastSearcher("container.0",
MockDispatcher.create(Collections.singletonList(new Node(0, "host0", 0))),
new SummaryParameters(null),
new ClusterParams("testhittype"),
- config);
+ documentDb,
+ new SchemaInfo(List.of(schema.build()), Map.of()));
Query q = new Query("?query=foo");
Result result = doSearch(backend, q, 0, 10);
assertFalse(backend.summaryNeedsQuery(q));
@@ -133,7 +145,8 @@ public class FastSearcherTestCase {
dispatcher,
new SummaryParameters(null),
new ClusterParams("testhittype"),
- documentdbInfoConfig);
+ documentdbInfoConfig,
+ SchemaInfo.empty());
Query q = new Query("?query=foo");
GroupingRequest request1 = GroupingRequest.newInstance(q);
request1.setRootOperation(new AllOperation());
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/documentdb-info.cfg b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/documentdb-info.cfg
deleted file mode 100644
index cc65ab2565e..00000000000
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/documentdb-info.cfg
+++ /dev/null
@@ -1,353 +0,0 @@
-documentdb[1]
-documentdb[0].name test
-documentdb[0].summaryclass[7]
-documentdb[0].summaryclass[0].name default
-documentdb[0].summaryclass[0].id 0
-documentdb[0].summaryclass[0].fields[19]
-documentdb[0].summaryclass[0].fields[0].name URL
-documentdb[0].summaryclass[0].fields[0].type string
-documentdb[0].summaryclass[0].fields[1].name TITLE
-documentdb[0].summaryclass[0].fields[1].type string
-documentdb[0].summaryclass[0].fields[2].name TEASER
-documentdb[0].summaryclass[0].fields[2].type string
-documentdb[0].summaryclass[0].fields[3].name TOPIC
-documentdb[0].summaryclass[0].fields[3].type string
-documentdb[0].summaryclass[0].fields[4].name FASTTOPIC
-documentdb[0].summaryclass[0].fields[4].type string
-documentdb[0].summaryclass[0].fields[5].name EXTINFO
-documentdb[0].summaryclass[0].fields[5].type string
-documentdb[0].summaryclass[0].fields[6].name EXTINFOSOURCE
-documentdb[0].summaryclass[0].fields[6].type byte
-documentdb[0].summaryclass[0].fields[7].name DSHOST
-documentdb[0].summaryclass[0].fields[7].type integer
-documentdb[0].summaryclass[0].fields[8].name DSKEY
-documentdb[0].summaryclass[0].fields[8].type integer
-documentdb[0].summaryclass[0].fields[9].name BYTES
-documentdb[0].summaryclass[0].fields[9].type integer
-documentdb[0].summaryclass[0].fields[10].name WORDS
-documentdb[0].summaryclass[0].fields[10].type integer
-documentdb[0].summaryclass[0].fields[11].name MODDATE
-documentdb[0].summaryclass[0].fields[11].type integer
-documentdb[0].summaryclass[0].fields[12].name CRAWLDATE
-documentdb[0].summaryclass[0].fields[12].type integer
-documentdb[0].summaryclass[0].fields[13].name LANG1
-documentdb[0].summaryclass[0].fields[13].type byte
-documentdb[0].summaryclass[0].fields[14].name LANG2
-documentdb[0].summaryclass[0].fields[14].type byte
-documentdb[0].summaryclass[0].fields[15].name LANG3
-documentdb[0].summaryclass[0].fields[15].type byte
-documentdb[0].summaryclass[0].fields[16].name LANG4
-documentdb[0].summaryclass[0].fields[16].type byte
-documentdb[0].summaryclass[0].fields[17].name IPADDRESS
-documentdb[0].summaryclass[0].fields[17].type integer
-documentdb[0].summaryclass[0].fields[18].name DOCVECTOR
-documentdb[0].summaryclass[0].fields[18].type data
-documentdb[0].summaryclass[1].name version1
-documentdb[0].summaryclass[1].id 1
-documentdb[0].summaryclass[1].fields[20]
-documentdb[0].summaryclass[1].fields[0].name URL
-documentdb[0].summaryclass[1].fields[0].type string
-documentdb[0].summaryclass[1].fields[1].name TITLE
-documentdb[0].summaryclass[1].fields[1].type string
-documentdb[0].summaryclass[1].fields[2].name TEASER
-documentdb[0].summaryclass[1].fields[2].type string
-documentdb[0].summaryclass[1].fields[3].name TOPIC
-documentdb[0].summaryclass[1].fields[3].type string
-documentdb[0].summaryclass[1].fields[4].name FASTTOPIC
-documentdb[0].summaryclass[1].fields[4].type string
-documentdb[0].summaryclass[1].fields[5].name EXTINFO
-documentdb[0].summaryclass[1].fields[5].type string
-documentdb[0].summaryclass[1].fields[6].name EXTINFOSOURCE
-documentdb[0].summaryclass[1].fields[6].type byte
-documentdb[0].summaryclass[1].fields[7].name DSHOST
-documentdb[0].summaryclass[1].fields[7].type integer
-documentdb[0].summaryclass[1].fields[8].name DSKEY
-documentdb[0].summaryclass[1].fields[8].type integer
-documentdb[0].summaryclass[1].fields[9].name BYTES
-documentdb[0].summaryclass[1].fields[9].type integer
-documentdb[0].summaryclass[1].fields[10].name WORDS
-documentdb[0].summaryclass[1].fields[10].type integer
-documentdb[0].summaryclass[1].fields[11].name MODDATE
-documentdb[0].summaryclass[1].fields[11].type integer
-documentdb[0].summaryclass[1].fields[12].name CRAWLDATE
-documentdb[0].summaryclass[1].fields[12].type integer
-documentdb[0].summaryclass[1].fields[13].name LANG1
-documentdb[0].summaryclass[1].fields[13].type byte
-documentdb[0].summaryclass[1].fields[14].name LANG2
-documentdb[0].summaryclass[1].fields[14].type byte
-documentdb[0].summaryclass[1].fields[15].name LANG3
-documentdb[0].summaryclass[1].fields[15].type byte
-documentdb[0].summaryclass[1].fields[16].name LANG4
-documentdb[0].summaryclass[1].fields[16].type byte
-documentdb[0].summaryclass[1].fields[17].name IPADDRESS
-documentdb[0].summaryclass[1].fields[17].type integer
-documentdb[0].summaryclass[1].fields[18].name DOCVECTOR
-documentdb[0].summaryclass[1].fields[18].type data
-documentdb[0].summaryclass[1].fields[19].name PARTNERSITEIDS
-documentdb[0].summaryclass[1].fields[19].type string
-documentdb[0].summaryclass[2].name version2
-documentdb[0].summaryclass[2].id 2
-documentdb[0].summaryclass[2].fields[21]
-documentdb[0].summaryclass[2].fields[0].name URL
-documentdb[0].summaryclass[2].fields[0].type string
-documentdb[0].summaryclass[2].fields[1].name TITLE
-documentdb[0].summaryclass[2].fields[1].type string
-documentdb[0].summaryclass[2].fields[2].name TEASER
-documentdb[0].summaryclass[2].fields[2].type string
-documentdb[0].summaryclass[2].fields[3].name TOPIC
-documentdb[0].summaryclass[2].fields[3].type string
-documentdb[0].summaryclass[2].fields[4].name FASTTOPIC
-documentdb[0].summaryclass[2].fields[4].type string
-documentdb[0].summaryclass[2].fields[5].name EXTINFO
-documentdb[0].summaryclass[2].fields[5].type string
-documentdb[0].summaryclass[2].fields[6].name EXTINFOSOURCE
-documentdb[0].summaryclass[2].fields[6].type byte
-documentdb[0].summaryclass[2].fields[7].name DSHOST
-documentdb[0].summaryclass[2].fields[7].type integer
-documentdb[0].summaryclass[2].fields[8].name DSKEY
-documentdb[0].summaryclass[2].fields[8].type integer
-documentdb[0].summaryclass[2].fields[9].name BYTES
-documentdb[0].summaryclass[2].fields[9].type integer
-documentdb[0].summaryclass[2].fields[10].name WORDS
-documentdb[0].summaryclass[2].fields[10].type integer
-documentdb[0].summaryclass[2].fields[11].name MODDATE
-documentdb[0].summaryclass[2].fields[11].type integer
-documentdb[0].summaryclass[2].fields[12].name CRAWLDATE
-documentdb[0].summaryclass[2].fields[12].type integer
-documentdb[0].summaryclass[2].fields[13].name LANG1
-documentdb[0].summaryclass[2].fields[13].type byte
-documentdb[0].summaryclass[2].fields[14].name LANG2
-documentdb[0].summaryclass[2].fields[14].type byte
-documentdb[0].summaryclass[2].fields[15].name LANG3
-documentdb[0].summaryclass[2].fields[15].type byte
-documentdb[0].summaryclass[2].fields[16].name LANG4
-documentdb[0].summaryclass[2].fields[16].type byte
-documentdb[0].summaryclass[2].fields[17].name IPADDRESS
-documentdb[0].summaryclass[2].fields[17].type integer
-documentdb[0].summaryclass[2].fields[18].name DOCVECTOR
-documentdb[0].summaryclass[2].fields[18].type data
-documentdb[0].summaryclass[2].fields[19].name PARTNERSITEIDS
-documentdb[0].summaryclass[2].fields[19].type string
-documentdb[0].summaryclass[2].fields[20].name DYNTEASER
-documentdb[0].summaryclass[2].fields[20].type string
-documentdb[0].summaryclass[3].name version3
-documentdb[0].summaryclass[3].id 3
-documentdb[0].summaryclass[3].fields[23]
-documentdb[0].summaryclass[3].fields[0].name URL
-documentdb[0].summaryclass[3].fields[0].type string
-documentdb[0].summaryclass[3].fields[1].name TITLE
-documentdb[0].summaryclass[3].fields[1].type string
-documentdb[0].summaryclass[3].fields[2].name TEASER
-documentdb[0].summaryclass[3].fields[2].type string
-documentdb[0].summaryclass[3].fields[3].name TOPIC
-documentdb[0].summaryclass[3].fields[3].type string
-documentdb[0].summaryclass[3].fields[4].name FASTTOPIC
-documentdb[0].summaryclass[3].fields[4].type string
-documentdb[0].summaryclass[3].fields[5].name EXTINFO
-documentdb[0].summaryclass[3].fields[5].type string
-documentdb[0].summaryclass[3].fields[6].name EXTINFOSOURCE
-documentdb[0].summaryclass[3].fields[6].type byte
-documentdb[0].summaryclass[3].fields[7].name DSHOST
-documentdb[0].summaryclass[3].fields[7].type integer
-documentdb[0].summaryclass[3].fields[8].name DSKEY
-documentdb[0].summaryclass[3].fields[8].type integer
-documentdb[0].summaryclass[3].fields[9].name BYTES
-documentdb[0].summaryclass[3].fields[9].type integer
-documentdb[0].summaryclass[3].fields[10].name WORDS
-documentdb[0].summaryclass[3].fields[10].type integer
-documentdb[0].summaryclass[3].fields[11].name MODDATE
-documentdb[0].summaryclass[3].fields[11].type integer
-documentdb[0].summaryclass[3].fields[12].name CRAWLDATE
-documentdb[0].summaryclass[3].fields[12].type integer
-documentdb[0].summaryclass[3].fields[13].name LANG1
-documentdb[0].summaryclass[3].fields[13].type byte
-documentdb[0].summaryclass[3].fields[14].name LANG2
-documentdb[0].summaryclass[3].fields[14].type byte
-documentdb[0].summaryclass[3].fields[15].name LANG3
-documentdb[0].summaryclass[3].fields[15].type byte
-documentdb[0].summaryclass[3].fields[16].name LANG4
-documentdb[0].summaryclass[3].fields[16].type byte
-documentdb[0].summaryclass[3].fields[17].name IPADDRESS
-documentdb[0].summaryclass[3].fields[17].type integer
-documentdb[0].summaryclass[3].fields[18].name DOCVECTOR
-documentdb[0].summaryclass[3].fields[18].type data
-documentdb[0].summaryclass[3].fields[19].name PARTNERSITEIDS
-documentdb[0].summaryclass[3].fields[19].type string
-documentdb[0].summaryclass[3].fields[20].name MIMETYPE
-documentdb[0].summaryclass[3].fields[20].type string
-documentdb[0].summaryclass[3].fields[21].name STATICRANKLOG
-documentdb[0].summaryclass[3].fields[21].type string
-documentdb[0].summaryclass[3].fields[22].name DYNTEASER
-documentdb[0].summaryclass[3].fields[22].type longstring
-documentdb[0].summaryclass[4].name version4
-documentdb[0].summaryclass[4].id 4
-documentdb[0].summaryclass[4].fields[24]
-documentdb[0].summaryclass[4].fields[0].name URL
-documentdb[0].summaryclass[4].fields[0].type string
-documentdb[0].summaryclass[4].fields[1].name CCURL
-documentdb[0].summaryclass[4].fields[1].type string
-documentdb[0].summaryclass[4].fields[2].name TITLE
-documentdb[0].summaryclass[4].fields[2].type string
-documentdb[0].summaryclass[4].fields[3].name TEASER
-documentdb[0].summaryclass[4].fields[3].type string
-documentdb[0].summaryclass[4].fields[4].name TOPIC
-documentdb[0].summaryclass[4].fields[4].type string
-documentdb[0].summaryclass[4].fields[5].name FASTTOPIC
-documentdb[0].summaryclass[4].fields[5].type string
-documentdb[0].summaryclass[4].fields[6].name EXTINFO
-documentdb[0].summaryclass[4].fields[6].type string
-documentdb[0].summaryclass[4].fields[7].name EXTINFOSOURCE
-documentdb[0].summaryclass[4].fields[7].type byte
-documentdb[0].summaryclass[4].fields[8].name DSHOST
-documentdb[0].summaryclass[4].fields[8].type integer
-documentdb[0].summaryclass[4].fields[9].name DSKEY
-documentdb[0].summaryclass[4].fields[9].type integer
-documentdb[0].summaryclass[4].fields[10].name BYTES
-documentdb[0].summaryclass[4].fields[10].type integer
-documentdb[0].summaryclass[4].fields[11].name WORDS
-documentdb[0].summaryclass[4].fields[11].type integer
-documentdb[0].summaryclass[4].fields[12].name MODDATE
-documentdb[0].summaryclass[4].fields[12].type integer
-documentdb[0].summaryclass[4].fields[13].name CRAWLDATE
-documentdb[0].summaryclass[4].fields[13].type integer
-documentdb[0].summaryclass[4].fields[14].name LANG1
-documentdb[0].summaryclass[4].fields[14].type byte
-documentdb[0].summaryclass[4].fields[15].name LANG2
-documentdb[0].summaryclass[4].fields[15].type byte
-documentdb[0].summaryclass[4].fields[16].name LANG3
-documentdb[0].summaryclass[4].fields[16].type byte
-documentdb[0].summaryclass[4].fields[17].name LANG4
-documentdb[0].summaryclass[4].fields[17].type byte
-documentdb[0].summaryclass[4].fields[18].name IPADDRESS
-documentdb[0].summaryclass[4].fields[18].type integer
-documentdb[0].summaryclass[4].fields[19].name DOCVECTOR
-documentdb[0].summaryclass[4].fields[19].type data
-documentdb[0].summaryclass[4].fields[20].name PARTNERSITEIDS
-documentdb[0].summaryclass[4].fields[20].type string
-documentdb[0].summaryclass[4].fields[21].name MIMETYPE
-documentdb[0].summaryclass[4].fields[21].type string
-documentdb[0].summaryclass[4].fields[22].name STATICRANKLOG
-documentdb[0].summaryclass[4].fields[22].type string
-documentdb[0].summaryclass[4].fields[23].name DYNTEASER
-documentdb[0].summaryclass[4].fields[23].type longstring
-documentdb[0].summaryclass[5].name version5
-documentdb[0].summaryclass[5].id 5
-documentdb[0].summaryclass[5].fields[25]
-documentdb[0].summaryclass[5].fields[0].name URL
-documentdb[0].summaryclass[5].fields[0].type string
-documentdb[0].summaryclass[5].fields[1].name URLLIST
-documentdb[0].summaryclass[5].fields[1].type string
-documentdb[0].summaryclass[5].fields[2].name CCURL
-documentdb[0].summaryclass[5].fields[2].type string
-documentdb[0].summaryclass[5].fields[3].name TITLE
-documentdb[0].summaryclass[5].fields[3].type string
-documentdb[0].summaryclass[5].fields[4].name TEASER
-documentdb[0].summaryclass[5].fields[4].type string
-documentdb[0].summaryclass[5].fields[5].name TOPIC
-documentdb[0].summaryclass[5].fields[5].type string
-documentdb[0].summaryclass[5].fields[6].name FASTTOPIC
-documentdb[0].summaryclass[5].fields[6].type string
-documentdb[0].summaryclass[5].fields[7].name EXTINFO
-documentdb[0].summaryclass[5].fields[7].type string
-documentdb[0].summaryclass[5].fields[8].name EXTINFOSOURCE
-documentdb[0].summaryclass[5].fields[8].type byte
-documentdb[0].summaryclass[5].fields[9].name DSHOST
-documentdb[0].summaryclass[5].fields[9].type integer
-documentdb[0].summaryclass[5].fields[10].name DSKEY
-documentdb[0].summaryclass[5].fields[10].type integer
-documentdb[0].summaryclass[5].fields[11].name BYTES
-documentdb[0].summaryclass[5].fields[11].type integer
-documentdb[0].summaryclass[5].fields[12].name WORDS
-documentdb[0].summaryclass[5].fields[12].type integer
-documentdb[0].summaryclass[5].fields[13].name MODDATE
-documentdb[0].summaryclass[5].fields[13].type integer
-documentdb[0].summaryclass[5].fields[14].name CRAWLDATE
-documentdb[0].summaryclass[5].fields[14].type integer
-documentdb[0].summaryclass[5].fields[15].name LANG1
-documentdb[0].summaryclass[5].fields[15].type byte
-documentdb[0].summaryclass[5].fields[16].name LANG2
-documentdb[0].summaryclass[5].fields[16].type byte
-documentdb[0].summaryclass[5].fields[17].name LANG3
-documentdb[0].summaryclass[5].fields[17].type byte
-documentdb[0].summaryclass[5].fields[18].name LANG4
-documentdb[0].summaryclass[5].fields[18].type byte
-documentdb[0].summaryclass[5].fields[19].name IPADDRESS
-documentdb[0].summaryclass[5].fields[19].type integer
-documentdb[0].summaryclass[5].fields[20].name DOCVECTOR
-documentdb[0].summaryclass[5].fields[20].type data
-documentdb[0].summaryclass[5].fields[21].name PARTNERSITEIDS
-documentdb[0].summaryclass[5].fields[21].type string
-documentdb[0].summaryclass[5].fields[22].name MIMETYPE
-documentdb[0].summaryclass[5].fields[22].type string
-documentdb[0].summaryclass[5].fields[23].name STATICRANKLOG
-documentdb[0].summaryclass[5].fields[23].type string
-documentdb[0].summaryclass[5].fields[24].name DYNTEASER
-documentdb[0].summaryclass[5].fields[24].type longstring
-documentdb[0].summaryclass[6].name withranklog
-documentdb[0].summaryclass[6].id 237
-documentdb[0].summaryclass[6].fields[31]
-documentdb[0].summaryclass[6].fields[0].name BYTES
-documentdb[0].summaryclass[6].fields[0].type integer
-documentdb[0].summaryclass[6].fields[1].name CCURL
-documentdb[0].summaryclass[6].fields[1].type string
-documentdb[0].summaryclass[6].fields[2].name CRAWLDATE
-documentdb[0].summaryclass[6].fields[2].type integer
-documentdb[0].summaryclass[6].fields[3].name DOCVECTOR
-documentdb[0].summaryclass[6].fields[3].type data
-documentdb[0].summaryclass[6].fields[4].name DSHOST
-documentdb[0].summaryclass[6].fields[4].type integer
-documentdb[0].summaryclass[6].fields[5].name DSKEY
-documentdb[0].summaryclass[6].fields[5].type integer
-documentdb[0].summaryclass[6].fields[6].name DYNTEASER
-documentdb[0].summaryclass[6].fields[6].type longstring
-documentdb[0].summaryclass[6].fields[7].name DYNTEASERINPUT
-documentdb[0].summaryclass[6].fields[7].type longstring
-documentdb[0].summaryclass[6].fields[8].name EXTINFO
-documentdb[0].summaryclass[6].fields[8].type string
-documentdb[0].summaryclass[6].fields[9].name EXTINFOSOURCE
-documentdb[0].summaryclass[6].fields[9].type byte
-documentdb[0].summaryclass[6].fields[10].name FASTTOPIC
-documentdb[0].summaryclass[6].fields[10].type string
-documentdb[0].summaryclass[6].fields[11].name IPADDRESS
-documentdb[0].summaryclass[6].fields[11].type integer
-documentdb[0].summaryclass[6].fields[12].name JUNIPER
-documentdb[0].summaryclass[6].fields[12].type longstring
-documentdb[0].summaryclass[6].fields[13].name JUNIPERMETRIC
-documentdb[0].summaryclass[6].fields[13].type integer
-documentdb[0].summaryclass[6].fields[14].name LABEL
-documentdb[0].summaryclass[6].fields[14].type string
-documentdb[0].summaryclass[6].fields[15].name LANG1
-documentdb[0].summaryclass[6].fields[15].type byte
-documentdb[0].summaryclass[6].fields[16].name LANG2
-documentdb[0].summaryclass[6].fields[16].type byte
-documentdb[0].summaryclass[6].fields[17].name LANG3
-documentdb[0].summaryclass[6].fields[17].type byte
-documentdb[0].summaryclass[6].fields[18].name LANG4
-documentdb[0].summaryclass[6].fields[18].type byte
-documentdb[0].summaryclass[6].fields[19].name MIMETYPE
-documentdb[0].summaryclass[6].fields[19].type string
-documentdb[0].summaryclass[6].fields[20].name MODDATE
-documentdb[0].summaryclass[6].fields[20].type integer
-documentdb[0].summaryclass[6].fields[21].name PARTNERSITEIDS
-documentdb[0].summaryclass[6].fields[21].type string
-documentdb[0].summaryclass[6].fields[22].name RANKLOG
-documentdb[0].summaryclass[6].fields[22].type string
-documentdb[0].summaryclass[6].fields[23].name STATICRANK
-documentdb[0].summaryclass[6].fields[23].type integer
-documentdb[0].summaryclass[6].fields[24].name STATICRANKLOG
-documentdb[0].summaryclass[6].fields[24].type string
-documentdb[0].summaryclass[6].fields[25].name TEASER
-documentdb[0].summaryclass[6].fields[25].type string
-documentdb[0].summaryclass[6].fields[26].name TITLE
-documentdb[0].summaryclass[6].fields[26].type string
-documentdb[0].summaryclass[6].fields[27].name TOPIC
-documentdb[0].summaryclass[6].fields[27].type string
-documentdb[0].summaryclass[6].fields[28].name URL
-documentdb[0].summaryclass[6].fields[28].type string
-documentdb[0].summaryclass[6].fields[29].name URLLIST
-documentdb[0].summaryclass[6].fields[29].type string
-documentdb[0].summaryclass[6].fields[30].name WORDS
-documentdb[0].summaryclass[6].fields[30].type integer
-documentdb[0].rankprofile[0].name "default"
-documentdb[0].rankprofile[0].hasSummaryFeatures false
-documentdb[0].rankprofile[0].hasRankFeatures false
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/vespa/HitConverterTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/vespa/HitConverterTestCase.java
index ba54c3808f2..6c66c8f4ca6 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/vespa/HitConverterTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/vespa/HitConverterTestCase.java
@@ -13,6 +13,8 @@ import com.yahoo.search.Result;
import com.yahoo.search.Searcher;
import com.yahoo.search.result.Hit;
import com.yahoo.search.result.Relevance;
+import com.yahoo.search.schema.DocumentSummary;
+import com.yahoo.search.schema.Schema;
import com.yahoo.search.searchchain.Execution;
import com.yahoo.searchlib.aggregation.FS4Hit;
import com.yahoo.searchlib.aggregation.VdsHit;
@@ -98,17 +100,17 @@ public class HitConverterTestCase {
return new GroupingListHit(Collections.emptyList(), null);
}
- private static DocumentdbInfoConfig.Documentdb sixtynine() {
- DocumentdbInfoConfig.Documentdb.Builder summaryConfig = new DocumentdbInfoConfig.Documentdb.Builder();
- summaryConfig.name("none");
- summaryConfig.summaryclass(new DocumentdbInfoConfig.Documentdb.Summaryclass.Builder().id(0).name("69"));
- return new DocumentdbInfoConfig.Documentdb(summaryConfig);
+ private static DocsumDefinitionSet sixtynine() {
+ var schema = new Schema.Builder("none");
+ var summary = new DocumentSummary.Builder("69");
+ schema.add(summary.build());
+ return new DocsumDefinitionSet(schema.build());
}
@Test
public void requireThatVdsHitCanBeConverted() {
HitConverter converter = new HitConverter(new MySearcher(), new Query());
- GroupingListHit context = new GroupingListHit(null, new DocsumDefinitionSet(sixtynine()));
+ GroupingListHit context = new GroupingListHit(null, sixtynine());
VdsHit lowHit = new VdsHit("id:ns:type::", new byte[] { 0x55, 0x55, 0x55, 0x55 }, 1);
lowHit.setContext(context);
Hit hit = converter.toSearchHit("69", lowHit);
diff --git a/container-search/src/test/java/com/yahoo/search/schema/SchemaInfoTester.java b/container-search/src/test/java/com/yahoo/search/schema/SchemaInfoTester.java
index ff996464c4a..45bf5af5258 100644
--- a/container-search/src/test/java/com/yahoo/search/schema/SchemaInfoTester.java
+++ b/container-search/src/test/java/com/yahoo/search/schema/SchemaInfoTester.java
@@ -69,6 +69,11 @@ public class SchemaInfoTester {
.add(new RankProfile.Builder("inconsistent")
.addInput("query(myTensor1)", TensorType.fromSpec("tensor(a{},b{})"))
.build())
+ .add(new DocumentSummary.Builder("testSummary")
+ .add(new DocumentSummary.Field("field1", "string"))
+ .add(new DocumentSummary.Field("field2", "integer"))
+ .setDynamic(true)
+ .build())
.build());
schemas.add(new Schema.Builder("b")
.add(common)
@@ -98,17 +103,32 @@ public class SchemaInfoTester {
var schemaInfoInfoConfig = new SchemaInfoConfig.Builder();
+ // ----- Schema A
var schemaA = new SchemaInfoConfig.Schema.Builder();
schemaA.name("a");
+
schemaA.rankprofile(rankProfileCommon);
var rankProfileInconsistentA = new SchemaInfoConfig.Schema.Rankprofile.Builder();
rankProfileInconsistentA.name("inconsistent");
rankProfileInconsistentA.input(new SchemaInfoConfig.Schema.Rankprofile.Input.Builder().name("query(myTensor1)").type("tensor(a{},b{})"));
schemaA.rankprofile(rankProfileInconsistentA);
+
+ var summaryClass = new SchemaInfoConfig.Schema.Summaryclass.Builder();
+ summaryClass.name("testSummary");
+ var field1 = new SchemaInfoConfig.Schema.Summaryclass.Fields.Builder();
+ field1.name("field1").type("string").dynamic(true);
+ summaryClass.fields(field1);
+ var field2 = new SchemaInfoConfig.Schema.Summaryclass.Fields.Builder();
+ field2.name("field2").type("integer");
+ summaryClass.fields(field2);
+ schemaA.summaryclass(summaryClass);
+
schemaInfoInfoConfig.schema(schemaA);
+ // ----- Schema B
var schemaB = new SchemaInfoConfig.Schema.Builder();
schemaB.name("b");
+
schemaB.rankprofile(rankProfileCommon);
var rankProfileInconsistentB = new SchemaInfoConfig.Schema.Rankprofile.Builder();
rankProfileInconsistentB.name("inconsistent");
@@ -118,8 +138,10 @@ public class SchemaInfoTester {
rankProfileBOnly.name("bOnly");
rankProfileBOnly.input(new SchemaInfoConfig.Schema.Rankprofile.Input.Builder().name("query(myTensor1)").type("tensor(a{},b{})"));
schemaB.rankprofile(rankProfileBOnly);
+
schemaInfoInfoConfig.schema(schemaB);
+ // ----- Info about which schemas are in which clusters
var qrSearchersConfig = new QrSearchersConfig.Builder();
var clusterAB = new QrSearchersConfig.Searchcluster.Builder();
clusterAB.name("ab");
diff --git a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java
index 1f074eeae78..861be9a3ade 100644
--- a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java
@@ -1,7 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.streamingvisitors;
-import com.yahoo.config.subscription.ConfigGetter;
import com.yahoo.document.select.parser.TokenMgrException;
import com.yahoo.messagebus.Trace;
import com.yahoo.messagebus.routing.Route;
@@ -13,6 +12,8 @@ import com.yahoo.prelude.fastsearch.TimeoutException;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.result.Hit;
+import com.yahoo.search.schema.Schema;
+import com.yahoo.search.schema.SchemaInfo;
import com.yahoo.search.searchchain.Execution;
import com.yahoo.searchlib.aggregation.Grouping;
import com.yahoo.vdslib.DocumentSummary;
@@ -219,12 +220,13 @@ public class VdsStreamingSearcherTestCase {
MockVisitorFactory factory = new MockVisitorFactory();
VdsStreamingSearcher searcher = new VdsStreamingSearcher(factory);
- ConfigGetter<DocumentdbInfoConfig> getter = new ConfigGetter<>(DocumentdbInfoConfig.class);
- DocumentdbInfoConfig config = getter.getConfig("file:src/test/java/com/yahoo/prelude/fastsearch/test/documentdb-info.cfg");
+ var schema = new Schema.Builder("test");
+ schema.add(new com.yahoo.search.schema.DocumentSummary.Builder("default").build());
searcher.init("container.0",
new SummaryParameters("default"),
new ClusterParams("clusterName"),
- config);
+ new DocumentdbInfoConfig.Builder().documentdb(new DocumentdbInfoConfig.Documentdb.Builder().name("test")).build(),
+ new SchemaInfo(List.of(schema.build()), Map.of()));
// Magic query values are used to trigger specific behaviors from mock visitor.
checkError(searcher, "/?query=noselection",