summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-06-23 16:07:21 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2023-06-23 16:07:21 +0200
commit2411fd83378f61b61db500497fae953f74bdb926 (patch)
tree65d7184bf26a5c4f4e485190967ac1809bcf1904
parentf70286142349f0d606b6462592a5048551e2f2f5 (diff)
Add support for controlling rank-score-drop-limit from container query time.
-rw-r--r--container-search/abi-spec.json3
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/Ranking.java10
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java3
3 files changed, 16 insertions, 0 deletions
diff --git a/container-search/abi-spec.json b/container-search/abi-spec.json
index e439f7905cc..c41c1c79149 100644
--- a/container-search/abi-spec.json
+++ b/container-search/abi-spec.json
@@ -5414,6 +5414,8 @@
"public java.lang.Integer getRerankCount()",
"public void setKeepRankCount(int)",
"public java.lang.Integer getKeepRankCount()",
+ "public void setRankScoreDropLimit(double)",
+ "public java.lang.Double getRankScoreDropLimit()",
"public com.yahoo.prelude.Location getLocation()",
"public void setLocation(com.yahoo.prelude.Location)",
"public void setLocation(java.lang.String)",
@@ -5449,6 +5451,7 @@
"public static final java.lang.String QUERYCACHE",
"public static final java.lang.String RERANKCOUNT",
"public static final java.lang.String KEEPRANKCOUNT",
+ "public static final java.lang.String RANKSCOREDROPLIMIT",
"public static final java.lang.String MATCH_PHASE",
"public static final java.lang.String DIVERSITY",
"public static final java.lang.String SOFTTIMEOUT",
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 5426268d173..ac32bec80ef 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
@@ -42,6 +42,7 @@ public class Ranking implements Cloneable {
public static final String QUERYCACHE = "queryCache";
public static final String RERANKCOUNT = "rerankCount";
public static final String KEEPRANKCOUNT = "keepRankCount";
+ public static final String RANKSCOREDROPLIMIT = "rankScoreDropLimit";
public static final String MATCH_PHASE = "matchPhase";
public static final String DIVERSITY = "diversity";
public static final String SOFTTIMEOUT = "softtimeout";
@@ -63,6 +64,7 @@ public class Ranking implements Cloneable {
argumentType.addField(new FieldDescription(QUERYCACHE, "boolean"));
argumentType.addField(new FieldDescription(RERANKCOUNT, "integer"));
argumentType.addField(new FieldDescription(KEEPRANKCOUNT, "integer"));
+ argumentType.addField(new FieldDescription(RANKSCOREDROPLIMIT, "double"));
argumentType.addField(new FieldDescription(MATCH_PHASE, new QueryProfileFieldType(MatchPhase.getArgumentType()), "matchPhase"));
argumentType.addField(new FieldDescription(DIVERSITY, new QueryProfileFieldType(Diversity.getArgumentType())));
argumentType.addField(new FieldDescription(SOFTTIMEOUT, new QueryProfileFieldType(SoftTimeout.getArgumentType())));
@@ -94,6 +96,7 @@ public class Ranking implements Cloneable {
private Integer rerankCount = null;
private Integer keepRankCount = null;
+ private Double rankScoreDropLimit = null;
private RankProperties rankProperties = new RankProperties();
@@ -165,6 +168,11 @@ public class Ranking implements Cloneable {
/** Returns the keep-rank-count that will be used, or null if not set */
public Integer getKeepRankCount() { return keepRankCount; }
+ /** Sets the rank-score-drop-limit that will be used, or null if not set */
+ public void setRankScoreDropLimit(double rankScoreDropLimit) { this.rankScoreDropLimit = rankScoreDropLimit; }
+ /** Returns the rank-score-drop-limit that will be used, or null if not set */
+ public Double getRankScoreDropLimit() { return rankScoreDropLimit; }
+
/** Returns the location of this query, or null if none */
public Location getLocation() { return location; }
@@ -241,6 +249,8 @@ public class Ranking implements Cloneable {
rankProperties.put("vespa.hitcollector.heapsize", rerankCount);
if (keepRankCount != null)
rankProperties.put("vespa.hitcollector.arraysize", keepRankCount);
+ if (rankScoreDropLimit != null)
+ rankProperties.put("vespa.hitcollector.rankscoredroplimit", rankScoreDropLimit);
}
private void prepareNow(Freshness freshness) {
diff --git a/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java b/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java
index da0051c527c..240da3f123f 100644
--- a/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java
+++ b/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java
@@ -77,6 +77,7 @@ public class QueryProperties extends Properties {
if (key.last().equals(Ranking.QUERYCACHE)) return ranking.getQueryCache();
if (key.last().equals(Ranking.RERANKCOUNT)) return ranking.getRerankCount();
if (key.last().equals(Ranking.KEEPRANKCOUNT)) return ranking.getKeepRankCount();
+ if (key.last().equals(Ranking.RANKSCOREDROPLIMIT)) return ranking.getRankScoreDropLimit();
if (key.last().equals(Ranking.LIST_FEATURES)) return ranking.getListFeatures();
}
else if (key.size() >= 3 && key.get(1).equals(Ranking.MATCH_PHASE)) {
@@ -203,6 +204,8 @@ public class QueryProperties extends Properties {
ranking.setRerankCount(asInteger(value, null));
else if (key.last().equals(Ranking.KEEPRANKCOUNT))
ranking.setKeepRankCount(asInteger(value, null));
+ else if (key.last().equals(Ranking.RANKSCOREDROPLIMIT))
+ ranking.setRankScoreDropLimit(asDouble(value, null));
else if (key.last().equals(Ranking.LIST_FEATURES))
ranking.setListFeatures(asBoolean(value,false));
else