diff options
Diffstat (limited to 'container-search/src/main/java/com/yahoo/prelude/fastsearch/VespaBackEndSearcher.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/prelude/fastsearch/VespaBackEndSearcher.java | 17 |
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 |