diff options
author | Jon Bratseth <bratseth@oath.com> | 2021-02-10 20:35:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-10 20:35:50 +0100 |
commit | ea2355efcef317ebfa71b49539f1a3a10d67d6d7 (patch) | |
tree | 68b4eca3bffd9d8ce101e152f2153eced282feec /container-search/src/main/java/com/yahoo/prelude | |
parent | 0c2467ffcb48354fd9d5074a74744db7a6d8f750 (diff) | |
parent | 1ac65ee103d17241b0815ecc81104f59c50771d6 (diff) |
Merge pull request #16429 from vespa-engine/bratseth/deprecate-score-threshold
Deprecate score-threshold
Diffstat (limited to 'container-search/src/main/java/com/yahoo/prelude')
3 files changed, 26 insertions, 27 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/query/WandItem.java b/container-search/src/main/java/com/yahoo/prelude/query/WandItem.java index a70d653b90a..89e85fe8f12 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/WandItem.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/WandItem.java @@ -17,7 +17,7 @@ import java.nio.ByteBuffer; */ public class WandItem extends WeightedSetItem { - private int targetNumHits; + private final int targetNumHits; private double scoreThreshold = 0; private double thresholdBoostFactor = 1; diff --git a/container-search/src/main/java/com/yahoo/prelude/query/WeakAndItem.java b/container-search/src/main/java/com/yahoo/prelude/query/WeakAndItem.java index 033986dc90f..4fa2ed8b214 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/WeakAndItem.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/WeakAndItem.java @@ -18,7 +18,7 @@ import java.nio.ByteBuffer; */ public final class WeakAndItem extends NonReducibleCompositeItem { - private int N; + private int n; private String index; private int scoreThreshold = 0; @@ -31,15 +31,15 @@ public final class WeakAndItem extends NonReducibleCompositeItem { } /** - * Make a WAND item with no children. You can mention a common index or you can mention it on each child. + * Make a WeakAnd item with no children. You can mention a common index or you can mention it on each child. * - * @param index The index it shall search. - * @param N the target for minimum number of hits to produce; + * @param index the index to search + * @param n the target for minimum number of hits to produce; * a backend will not suppress any hits in the operator * until N hits have been produced. - **/ - public WeakAndItem(String index, int N) { - this.N = N; + */ + public WeakAndItem(String index, int n) { + this.n = n; this.index = (index == null) ? "" : index; } public WeakAndItem(int N) { @@ -61,7 +61,7 @@ public final class WeakAndItem extends NonReducibleCompositeItem { protected void appendHeadingString(StringBuilder buffer) { buffer.append(getName()); buffer.append("("); - buffer.append(N); + buffer.append(n); buffer.append(")"); buffer.append(" "); } @@ -75,53 +75,52 @@ public final class WeakAndItem extends NonReducibleCompositeItem { } public int getN() { - return N; + return n; } public void setN(int N) { - this.N = N; + this.n = N; } + @Deprecated // TODO: Remove on Vespa 8 public int getScoreThreshold() { return scoreThreshold; } /** - * Sets the score threshold used by the backend search operator handling this WeakAndItem. - * This threshold is currently only used if the WeakAndItem is searching a RISE index field. - * The score threshold then specifies the minimum dot product score a match needs to be part of the result set. - * Default value is 0. + * Noop. * - * @param scoreThreshold the score threshold. + * @deprecated has no effect */ + @Deprecated // TODO: Remove on Vespa 8 public void setScoreThreshold(int scoreThreshold) { this.scoreThreshold = scoreThreshold; } + @Override protected void encodeThis(ByteBuffer buffer) { super.encodeThis(buffer); - IntegerCompressor.putCompressedPositiveNumber(N, buffer); + IntegerCompressor.putCompressedPositiveNumber(n, buffer); putString(index, buffer); } @Override public void disclose(Discloser discloser) { super.disclose(discloser); - discloser.addProperty("N", N); + discloser.addProperty("N", n); } + @Override public int hashCode() { - return super.hashCode() + 31 * N; + return super.hashCode() + 31 * n; } - /** - * Returns whether this item is of the same class and - * contains the same state as the given item - */ + /** Returns whether this item is of the same class and contains the same state as the given item. */ + @Override public boolean equals(Object object) { if (!super.equals(object)) return false; WeakAndItem other = (WeakAndItem) object; // Ensured by superclass - if (this.N != other.N) return false; + if (this.n != other.n) return false; return true; } diff --git a/container-search/src/main/java/com/yahoo/prelude/query/parser/AdvancedParser.java b/container-search/src/main/java/com/yahoo/prelude/query/parser/AdvancedParser.java index e2dc5df5242..74a993b0413 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/parser/AdvancedParser.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/parser/AdvancedParser.java @@ -148,10 +148,10 @@ public class AdvancedParser extends StructuredParser { } return topLevelItem; } else if (isTheWord("wand", item)) { - int n=consumeNumericArgument(); - if (n==0) + int n = consumeNumericArgument(); + if (n == 0) n=WeakAndItem.defaultN; - if (topLevelIsClosed || !(topLevelItem instanceof WeakAndItem) || n!=((WeakAndItem)topLevelItem).getN()) { + if (topLevelIsClosed || !(topLevelItem instanceof WeakAndItem) || n != ((WeakAndItem)topLevelItem).getN()) { WeakAndItem wand = new WeakAndItem(); wand.setN(n); wand.addItem(topLevelItem); |