aboutsummaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-01-08 14:42:36 +0000
committerArne Juul <arnej@verizonmedia.com>2021-01-08 14:42:36 +0000
commitfeef42f47a71d1bc9028d2151d6725e4917db1bd (patch)
treecc1db0f28a4f5c58a565bacd90a55a3ece8a96af /container-search
parent290cc71ab1aa3b6c8eedd93d82351000873bb300 (diff)
only send distanceThreshold conditionally
* abuse a bit in the "allow approximation" integer * we want to cleanup this in several steps later.
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/query/NearestNeighborItem.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/query/NearestNeighborItem.java b/container-search/src/main/java/com/yahoo/prelude/query/NearestNeighborItem.java
index 4a827813e81..bb95cbad178 100644
--- a/container-search/src/main/java/com/yahoo/prelude/query/NearestNeighborItem.java
+++ b/container-search/src/main/java/com/yahoo/prelude/query/NearestNeighborItem.java
@@ -79,10 +79,18 @@ public class NearestNeighborItem extends SimpleTaggableItem {
super.encodeThis(buffer);
putString(field, buffer);
putString(queryTensorName, buffer);
+ int approxNum = (approximate ? 1 : 0);
+ // should become always-true later:
+ boolean sendDistanceThreshold = (distanceThreshold < Double.POSITIVE_INFINITY);
+ if (sendDistanceThreshold) {
+ approxNum |= 0x40; // temporary flag bit
+ }
IntegerCompressor.putCompressedPositiveNumber(targetNumHits, buffer);
- IntegerCompressor.putCompressedPositiveNumber((approximate ? 1 : 0), buffer);
+ IntegerCompressor.putCompressedPositiveNumber(approxNum, buffer);
IntegerCompressor.putCompressedPositiveNumber(hnswExploreAdditionalHits, buffer);
- buffer.putDouble(distanceThreshold);
+ if (sendDistanceThreshold) {
+ buffer.putDouble(distanceThreshold);
+ }
return 1; // number of encoded stack dump items
}