diff options
3 files changed, 16 insertions, 0 deletions
diff --git a/container-search/abi-spec.json b/container-search/abi-spec.json index 17b95162709..ab8718508b7 100644 --- a/container-search/abi-spec.json +++ b/container-search/abi-spec.json @@ -5350,6 +5350,8 @@ "public boolean getQueryCache()", "public void setRerankCount(int)", "public java.lang.Integer getRerankCount()", + "public void setKeepRankCount(int)", + "public java.lang.Integer getKeepRankCount()", "public com.yahoo.prelude.Location getLocation()", "public void setLocation(com.yahoo.prelude.Location)", "public void setLocation(java.lang.String)", @@ -5384,6 +5386,7 @@ "public static final java.lang.String FRESHNESS", "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 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 279ec3b0ff2..77c1d0aa621 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 @@ -45,6 +45,7 @@ public class Ranking implements Cloneable { public static final String FRESHNESS = "freshness"; public static final String QUERYCACHE = "queryCache"; public static final String RERANKCOUNT = "rerankCount"; + public static final String KEEPRANKCOUNT = "keepRankCount"; public static final String MATCH_PHASE = "matchPhase"; public static final String DIVERSITY = "diversity"; public static final String SOFTTIMEOUT = "softtimeout"; @@ -65,6 +66,7 @@ public class Ranking implements Cloneable { argumentType.addField(new FieldDescription(FRESHNESS, "string", "datetime")); argumentType.addField(new FieldDescription(QUERYCACHE, "boolean")); argumentType.addField(new FieldDescription(RERANKCOUNT, "integer")); + argumentType.addField(new FieldDescription(KEEPRANKCOUNT, "integer")); 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()))); @@ -95,6 +97,7 @@ public class Ranking implements Cloneable { private boolean queryCache = false; private Integer rerankCount = null; + private Integer keepRankCount = null; private RankProperties rankProperties = new RankProperties(); @@ -161,6 +164,11 @@ public class Ranking implements Cloneable { /** Returns the rerank-count that will be used, or null if not set */ public Integer getRerankCount() { return rerankCount; } + /** Sets the keep-rank-count that will be used, or null if not set */ + public void setKeepRankCount(int keepRankCount) { this.keepRankCount = keepRankCount; } + /** Returns the keep-rank-count that will be used, or null if not set */ + public Integer getKeepRankCount() { return keepRankCount; } + /** Returns the location of this query, or null if none */ public Location getLocation() { return location; } @@ -235,6 +243,8 @@ public class Ranking implements Cloneable { prepareNow(freshness); if (rerankCount != null) rankProperties.put("vespa.hitcollector.heapsize", rerankCount); + if (keepRankCount != null) + rankProperties.put("vespa.hitcollector.arraysize", keepRankCount); } 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 085a6382a13..d5dc8120f29 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 @@ -74,6 +74,7 @@ public class QueryProperties extends Properties { if (key.last().equals(Ranking.FRESHNESS)) return ranking.getFreshness(); 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.LIST_FEATURES)) return ranking.getListFeatures(); } else if (key.size() >= 3 && key.get(1).equals(Ranking.MATCH_PHASE)) { @@ -198,6 +199,8 @@ public class QueryProperties extends Properties { ranking.setQueryCache(asBoolean(value, false)); else if (key.last().equals(Ranking.RERANKCOUNT)) ranking.setRerankCount(asInteger(value, null)); + else if (key.last().equals(Ranking.KEEPRANKCOUNT)) + ranking.setKeepRankCount(asInteger(value, null)); else if (key.last().equals(Ranking.LIST_FEATURES)) ranking.setListFeatures(asBoolean(value,false)); else |