summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/prelude
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-05-03 20:22:43 +0200
committerGitHub <noreply@github.com>2022-05-03 20:22:43 +0200
commitdde286759cc3384f07b957364d3c9666aff60896 (patch)
treefa9b6fe4f2caef38b3536f92ceb703f49afc713c /container-search/src/main/java/com/yahoo/prelude
parentde8e6f7128dc6489800eae8ce8cdcc6e3414475e (diff)
Revert "Use schema-info"
Diffstat (limited to 'container-search/src/main/java/com/yahoo/prelude')
-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
8 files changed, 153 insertions, 79 deletions
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 23ba3b0619c..3953190eac4 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,11 +18,9 @@ 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;
@@ -78,7 +76,6 @@ public class ClusterSearcher extends Searcher {
QrSearchersConfig qrsConfig,
ClusterConfig clusterConfig,
DocumentdbInfoConfig documentDbConfig,
- SchemaInfo schemaInfo,
ComponentRegistry<Dispatcher> dispatchers,
VipStatus vipStatus,
VespaDocumentAccess access) {
@@ -102,11 +99,11 @@ public class ClusterSearcher extends Searcher {
String uniqueServerId = UUID.randomUUID().toString();
if (searchClusterConfig.indexingmode() == STREAMING) {
server = vdsCluster(uniqueServerId, searchClusterIndex,
- searchClusterConfig, docSumParams, documentDbConfig, schemaInfo, access);
+ searchClusterConfig, docSumParams, documentDbConfig, access);
vipStatus.addToRotation(server.getName());
} else {
server = searchDispatch(searchClusterIndex, searchClusterName, uniqueServerId,
- docSumParams, documentDbConfig, schemaInfo, dispatchers);
+ docSumParams, documentDbConfig, dispatchers);
}
}
@@ -128,7 +125,6 @@ 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);
@@ -136,7 +132,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, schemaInfo);
+ return new FastSearcher(serverId, dispatcher, docSumParams, clusterParams, documentdbInfoConfig);
}
private static VdsStreamingSearcher vdsCluster(String serverId,
@@ -144,7 +140,6 @@ 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());
@@ -154,7 +149,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, schemaInfo);
+ searcher.init(serverId, docSumParams, clusterParams, documentdbInfoConfig);
return searcher;
}
@@ -223,7 +218,7 @@ public class ClusterSearcher extends Searcher {
}
private Set<String> schemasHavingProfile(String profile, Execution.Context context) {
- return context.schemaInfo().schemas().values().stream()
+ return context.schemaInfo().schemas().stream()
.filter(schema -> schema.rankProfiles().containsKey(profile))
.map(schema -> schema.name())
.collect(Collectors.toSet());
@@ -239,8 +234,7 @@ 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 33b912da42f..8a7d14d5f49 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,11 +1,15 @@
// 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.stream.Collectors;
+import java.util.Set;
/**
* A docsum definition which knows how to decode a certain class of document
@@ -17,26 +21,55 @@ import java.util.stream.Collectors;
public class DocsumDefinition {
private final String name;
- private final Map<String, DocsumField> fields;
+ private final ImmutableList<DocsumField> fields;
/** True if this contains dynamic fields */
private final boolean dynamic;
- 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));
+ // 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 String name() { return name; }
- public Map<String, DocsumField> fields() { return fields; }
+ DocsumDefinition(DocumentdbInfoConfig.Documentdb.Summaryclass config) {
+ this.name = config.name();
- /** Returns whether this summary contains one or more dynamic fields */
- public boolean isDynamic() { return dynamic; }
+ 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);
+ }
+
+ /** 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 the given slime value as the type specified in this, or null if the type is not known.
@@ -45,14 +78,35 @@ public class DocsumDefinition {
* another has not.
*/
public Object convert(String fieldName, Inspector value) {
- DocsumField field = fields.get(fieldName);
- if (field == null || ! value.valid()) return null;
- return field.convert(value);
+ DocsumField fieldType = getField(fieldName);
+ if (fieldType == null || ! value.valid()) return null;
+ return fieldType.convert(value);
+ }
+
+ public Set<String> fieldNames() {
+ return fieldNameToIndex.keySet();
}
@Override
public String toString() {
- return "docsum definition '" + name() + "'";
+ 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;
}
}
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 2b26cd29b78..1e0cfa3be9e 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,8 +1,7 @@
// 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.yahoo.search.schema.DocumentSummary;
-import com.yahoo.search.schema.Schema;
+import com.google.common.collect.ImmutableMap;
import com.yahoo.slime.BinaryFormat;
import com.yahoo.data.access.Inspector;
import com.yahoo.slime.Slime;
@@ -11,6 +10,7 @@ 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,15 +31,12 @@ public final class DocsumDefinitionSet {
private final Map<String, DocsumDefinition> definitionsByName;
- public DocsumDefinitionSet(Schema schema) {
- this(schema.documentSummaries().values());
+ public DocsumDefinitionSet(DocumentdbInfoConfig.Documentdb config) {
+ this(toDocsums(config));
}
- public DocsumDefinitionSet(Collection<DocumentSummary> docsumDefinitions) {
- this.definitionsByName = docsumDefinitions.stream()
- .map(summary -> new DocsumDefinition(summary))
- .collect(Collectors.toUnmodifiableMap(summary -> summary.name(),
- summary -> summary));
+ public DocsumDefinitionSet(Collection<DocsumDefinition> docsumDefinitions) {
+ this.definitionsByName = ImmutableMap.copyOf(docsumDefinitions.stream().collect(Collectors.toMap(DocsumDefinition::getName, p -> p)));
}
/**
@@ -48,15 +45,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;
}
@@ -98,7 +95,7 @@ public final class DocsumDefinitionSet {
if (sb.length() != 0) {
sb.append(",");
}
- sb.append("[").append(e.getKey()).append(",").append(e.getValue().name()).append("]");
+ sb.append("[").append(e.getKey()).append(",").append(e.getValue().getName()).append("]");
}
return sb.toString();
}
@@ -107,4 +104,13 @@ 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 e6201a694cb..e412258ff15 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 final FieldFactory fieldFactory;
+ private static FieldFactory fieldFactory;
private static class FieldFactory {
@@ -32,7 +32,8 @@ public abstract class DocsumField {
DocsumField create(String typename, String name)
throws InstantiationException, IllegalAccessException,
IllegalArgumentException, InvocationTargetException {
- return constructors.get(typename).newInstance(name);
+ DocsumField f = constructors.get(typename).newInstance(name);
+ return f;
}
}
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 72ccf4aa1dd..67038e0e771 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,8 +2,6 @@
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;
@@ -19,20 +17,48 @@ 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 Schema schema;
+ private final String name;
private final DocsumDefinitionSet docsumDefSet;
- public DocumentDatabase(Schema schema) {
- this.schema = schema;
- this.docsumDefSet = new DocsumDefinitionSet(schema);
+ private final Map<String, RankProfile> rankProfiles;
+
+ public DocumentDatabase(DocumentdbInfoConfig.Documentdb documentDb) {
+ this(documentDb.name(), new DocsumDefinitionSet(documentDb), toRankProfiles(documentDb.rankprofile()));
}
- public Schema schema() { return 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;
+ }
- /** Returns the document summary model in this which knows how to convert serialized data to hit fields. */
- public DocsumDefinitionSet getDocsumDefinitionSet() { return docsumDefSet; }
+ 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;
+ }
}
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 a094be943a2..094367dc140 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.fields().keySet());
+ removedFields.removeAll(docsumDef.fieldNames());
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.fields().get(name);
+ DocsumField fieldType = type.getField(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.fields().containsKey(name))
+ if (hit.summaries.get(i).type.fieldNames().contains(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 33ad8d8c9a8..27a45753bb5 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,7 +6,6 @@ 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;
@@ -16,7 +15,6 @@ 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;
@@ -53,13 +51,10 @@ 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,
- SchemaInfo schemaInfo) {
- init(serverId, docSumParams, clusterParams, documentdbInfoConfig, schemaInfo);
+ public FastSearcher(String serverId, Dispatcher dispatcher,
+ SummaryParameters docSumParams, ClusterParams clusterParams,
+ DocumentdbInfoConfig documentdbInfoConfig) {
+ init(serverId, docSumParams, clusterParams, documentdbInfoConfig);
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 21037be1a8b..3847e80d3c7 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,12 +14,10 @@ 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;
@@ -109,7 +107,7 @@ public abstract class VespaBackEndSearcher extends PingableSearcher {
if (hasLocation(query.getModel().getQueryTree())) return true;
// Needed to generate ranking features?
- RankProfile rankProfile = documentDb.schema().rankProfiles().get(query.getRanking().getProfile());
+ RankProfile rankProfile = documentDb.rankProfiles().get(query.getRanking().getProfile());
if (rankProfile == null) return true; // stay safe
if (rankProfile.hasSummaryFeatures()) return true;
if (query.getRanking().getListFeatures()) return true;
@@ -135,12 +133,12 @@ public abstract class VespaBackEndSearcher extends PingableSearcher {
private void resolveDocumentDatabase(Query query) {
DocumentDatabase docDb = getDocumentDatabase(query);
if (docDb != null) {
- query.getModel().setDocumentDb(docDb.schema().name());
+ query.getModel().setDocumentDb(docDb.getName());
}
}
public final void init(String serverId, SummaryParameters docSumParams, ClusterParams clusterParams,
- DocumentdbInfoConfig documentdbInfoConfig, SchemaInfo schemaInfo) {
+ DocumentdbInfoConfig documentdbInfoConfig) {
this.serverId = serverId;
this.name = clusterParams.searcherName;
@@ -150,9 +148,10 @@ public abstract class VespaBackEndSearcher extends PingableSearcher {
if (documentdbInfoConfig != null) {
for (DocumentdbInfoConfig.Documentdb docDb : documentdbInfoConfig.documentdb()) {
- DocumentDatabase db = new DocumentDatabase(schemaInfo.schemas().get(docDb.name()));
- if (documentDbs.isEmpty())
+ DocumentDatabase db = new DocumentDatabase(docDb);
+ if (documentDbs.isEmpty()) {
defaultDocumentDb = db;
+ }
documentDbs.put(docDb.name(), db);
}
}
@@ -160,7 +159,6 @@ 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();
@@ -393,7 +391,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.schema().name());
+ hit.setField(Hit.SDDOCNAME_FIELD, db.getName());
return decodeSummary(summaryClass, hit, docsumdata, db.getDocsumDefinitionSet());
}