diff options
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/Ranking.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/query/Ranking.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/Ranking.java b/container-search/src/main/java/com/yahoo/search/query/Ranking.java index 903eedfe870..0d3aa01a85b 100644 --- a/container-search/src/main/java/com/yahoo/search/query/Ranking.java +++ b/container-search/src/main/java/com/yahoo/search/query/Ranking.java @@ -1,9 +1,10 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.search.query; -import com.yahoo.processing.request.CompoundName; +import ai.vespa.searchlib.searchprotocol.protobuf.Search; import com.yahoo.prelude.Freshness; import com.yahoo.prelude.Location; +import com.yahoo.processing.request.CompoundName; import com.yahoo.search.Query; import com.yahoo.search.query.profile.types.FieldDescription; import com.yahoo.search.query.profile.types.QueryProfileFieldType; @@ -268,4 +269,19 @@ public class Ranking implements Cloneable { } } + public void addToProtobuf(Search.Request.Builder builder, boolean includeQueryData) { + builder.setRankProfile(getProfile()); + if (queryCache) { + builder.setCacheQuery(true); + } + if(sorting != null) { + sorting.addToProtobuf(builder, includeQueryData); + } + if(location != null) { + builder.setGeoLocation(location.toString()); + } + rankFeatures.addToProtobuf(builder, includeQueryData); + rankProperties.addToProtobuf(builder, includeQueryData); + } + } |