summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2020-08-20 10:33:34 +0000
committerArne Juul <arnej@verizonmedia.com>2020-08-20 10:33:37 +0000
commitbdc433fbea234f0f08cab8fc89ee4cf6453c4e72 (patch)
treeaade959fc056d1d4d838266742ca67bc5f6538b8 /container-search/src/main/java/com
parent3b436b2f9fac45c8e89a2a58022282e7622864b0 (diff)
ensure that locations are sent down
* when the query tree contains a GeoLocationItem somewhere, it is quite likely that this will be used for producing a summary field, and therefore summaryNeedsQuery should return true in this case.
Diffstat (limited to 'container-search/src/main/java/com')
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/fastsearch/VespaBackEndSearcher.java17
1 files changed, 17 insertions, 0 deletions
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 e5e46f21a2a..2090390890e 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
@@ -3,6 +3,8 @@ package com.yahoo.prelude.fastsearch;
import com.yahoo.collections.TinyIdentitySet;
import com.yahoo.fs4.DocsumPacket;
+import com.yahoo.prelude.query.CompositeItem;
+import com.yahoo.prelude.query.GeoLocationItem;
import com.yahoo.prelude.query.Item;
import com.yahoo.prelude.query.NullItem;
import com.yahoo.prelude.query.textualrepresentation.TextualQueryRepresentation;
@@ -74,6 +76,19 @@ public abstract class VespaBackEndSearcher extends PingableSearcher {
protected abstract void doPartialFill(Result result, String summaryClass);
+ private boolean hasLocation(Item tree) {
+ if (tree instanceof GeoLocationItem) {
+ return true;
+ }
+ if (tree instanceof CompositeItem) {
+ var composite = (CompositeItem)tree;
+ for (Item child : composite.items()) {
+ if (hasLocation(child)) return true;
+ }
+ }
+ return false;
+ }
+
/**
* Returns whether we need to send the query when fetching summaries.
* This is necessary if the query requests summary features or dynamic snippeting
@@ -87,6 +102,8 @@ public abstract class VespaBackEndSearcher extends PingableSearcher {
DocsumDefinition docsumDefinition = documentDb.getDocsumDefinitionSet().getDocsum(query.getPresentation().getSummary());
if (docsumDefinition.isDynamic()) return true;
+ if (hasLocation(query.getModel().getQueryTree())) return true;
+
// Needed to generate ranking features?
RankProfile rankProfile = documentDb.rankProfiles().get(query.getRanking().getProfile());
if (rankProfile == null) return true; // stay safe