summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-04-16 16:03:51 +0200
committerJon Bratseth <bratseth@oath.com>2018-04-16 16:03:51 +0200
commita265f4fc82f6eb02d3bb0af40deaac12e282d9de (patch)
tree32257eb7142eaea9b4951ade1fa4d4fb80b9f339 /container-search
parentb04c39e4979510c481b0919f89c4c9dfa29eac20 (diff)
Don't use RPC if legacy emulation is used
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinitionSet.java2
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java16
2 files changed, 16 insertions, 2 deletions
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 8bfb1035f1c..3ecc01a5e8e 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
@@ -51,6 +51,8 @@ public final class DocsumDefinitionSet {
this.emulationConfig = emulConfig;
}
+ LegacyEmulationConfig legacyEmulationConfig() { return emulationConfig; }
+
/**
* Returns a docsum definition by name, or null if not found
*
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 3cc982f9573..527b5230018 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
@@ -4,6 +4,7 @@ package com.yahoo.prelude.fastsearch;
import java.util.Optional;
import com.yahoo.compress.CompressionType;
+import com.yahoo.container.search.LegacyEmulationConfig;
import com.yahoo.fs4.BasicPacket;
import com.yahoo.fs4.ChannelTimeoutException;
import com.yahoo.fs4.GetDocSumsPacket;
@@ -15,7 +16,6 @@ import com.yahoo.fs4.QueryResultPacket;
import com.yahoo.fs4.mplex.Backend;
import com.yahoo.fs4.mplex.FS4Channel;
import com.yahoo.fs4.mplex.InvalidChannelException;
-import com.yahoo.net.HostName;
import com.yahoo.prelude.Ping;
import com.yahoo.prelude.Pong;
import com.yahoo.prelude.querytransform.QueryRewrite;
@@ -234,6 +234,7 @@ public class FastSearcher extends VespaBackEndSearcher {
/**
* Only used to fill the sddocname field when using direct dispatching as that is normally done in VespaBackEndSearcher.decodeSummary
+ *
* @param result The result
*/
private void fillSDDocName(Result result) {
@@ -258,7 +259,10 @@ public class FastSearcher extends VespaBackEndSearcher {
Query query = result.getQuery();
traceQuery(getName(), "fill", query, query.getOffset(), query.getHits(), 2, quotedSummaryClass(summaryClass));
- if (query.properties().getBoolean(dispatchSummaries, true) && !summaryNeedsQuery(query)) {
+ if (query.properties().getBoolean(dispatchSummaries, true)
+ && ! summaryNeedsQuery(query)
+ && ! legacyEmulationConfigIsSet(getDocumentDatabase(query))) {
+
CompressionType compression =
CompressionType.valueOf(query.properties().getString(dispatchCompression, "LZ4").toUpperCase());
fillSDDocName(result);
@@ -352,6 +356,14 @@ public class FastSearcher extends VespaBackEndSearcher {
}
}
+ private boolean legacyEmulationConfigIsSet(DocumentDatabase db) {
+ LegacyEmulationConfig config = db.getDocsumDefinitionSet().legacyEmulationConfig();
+ if (config.forceFillEmptyFields()) return true;
+ if (config.stringBackedFeatureData()) return true;
+ if (config.stringBackedStructuredData()) return true;
+ return false;
+ }
+
private static @NonNull Optional<String> quotedSummaryClass(String summaryClass) {
return Optional.of(summaryClass == null ? "[null]" : quote(summaryClass));
}