Skip to content

Commit 3b3f076

Browse files
committed
Document totalTargetHits
1 parent 4c5fa13 commit 3b3f076

14 files changed

Lines changed: 127 additions & 98 deletions

en/clients/vespa-cli.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ <h3 id="queries">Queries</h3>
233233
<p>Example query file:</p>
234234
<pre>{% highlight json %}
235235
{
236-
"yql": "select product_id, title from products where {targetHits: 200}nearestNeighbor(dense_embedding, q_vector)",
236+
"yql": "select product_id, title from products where {totalTargetHits: 200}nearestNeighbor(dense_embedding, q_vector)",
237237
"input.query(q_vector)": [-0.050548091530799866, ... ,0.028366032987833023],
238238
"ranking": "vector_distance"
239239
}

en/performance/practical-search-performance-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ Repeating the query from above, replacing `dotProduct` with `wand`:
11221122
<button class="d-icon d-duplicate pre-copy-button" onclick="copyPreContent(this)"></button>
11231123
<pre data-test="exec" data-test-assert-contains="Vastarannan valssi">
11241124
$ vespa query \
1125-
'yql=select track_id, title, artist, tags from track where {targetHits:10}wand(tags, @userProfile)' \
1125+
'yql=select track_id, title, artist, tags from track where {totalTargetHits:10}wand(tags, @userProfile)' \
11261126
'userProfile={"hard rock":1, "rock":1,"metal":1, "finnish metal":1}' \
11271127
'hits=1' \
11281128
'ranking=personalized'

en/querying/approximate-nn-hnsw.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ or exact (brute-force) search by using the [approximate query annotation](../ref
134134

135135
<pre>
136136
{
137-
"yql": "select * from doc where {targetHits: 100, approximate:false}nearestNeighbor(image_embeddings,query_image_embedding)",
137+
"yql": "select * from doc where {totalTargetHits: 10, approximate:false}nearestNeighbor(image_embeddings,query_image_embedding)",
138138
"hits": 10
139139
"input.query(query_image_embedding)": [0.21,0.12,....],
140140
"ranking.profile": "image_similarity"
@@ -150,9 +150,9 @@ Note that exact searches over a large vector volume require adjustment of the
150150
The default [query timeout](../reference/api/query.html#timeout) is 500ms,
151151
which will be too low for an exact search over many vectors.
152152

153-
In addition to [targetHits](../reference/querying/yql.html#targethits),
153+
In addition to [totalTargetHits](../reference/querying/yql.html#totaltargethits),
154154
there is a [hnsw.exploreAdditionalHits](../reference/querying/yql.html#hnsw-exploreadditionalhits) parameter
155-
which controls how many extra nodes in the graph (in addition to `targetHits`)
155+
which controls how many extra nodes in the graph (in addition to `totalTargetHits`)
156156
that are explored during the graph search. This parameter is used to tune accuracy quality versus query performance.
157157

158158
## Combining approximate nearest neighbor search with filters
@@ -174,22 +174,23 @@ Note that when using `pre-filtering` the following query operators are not inclu
174174
* [predicate](../reference/querying/yql.html#predicate)
175175

176176
These are instead evaluated after the approximate nearest neighbors are retrieved, more like a `post-filter`.
177-
This might cause the search to expose fewer hits to ranking than the wanted `targetHits`.
177+
This might cause the search to expose fewer hits to ranking than the wanted `totalTargetHits`.
178178

179179
Since {% include version.html version="8.78" %} the `pre-filter` can be evaluated using
180180
[multiple threads per query](../performance/practical-search-performance-guide.html#multithreaded-search-and-ranking).
181181
This can be used to reduce query latency for larger vector datasets where the cost of evaluating the `pre-filter` is significant.
182182
Note that searching the `HNSW` index is always single-threaded per query.
183183
Multithreaded evaluation when using `post-filtering` has always been supported,
184-
but this is less relevant as the `HNSW` index search first reduces the document candidate set based on `targetHits`.
184+
but this is less relevant as the `HNSW` index search first reduces the document candidate set based on `totalTargetHits`.
185185

186186
## Nearest Neighbor Search Considerations
187187

188-
* **targetHits**:
189-
The [targetHits](../reference/querying/yql.html#targethits)
190-
specifies how many hits one wants to expose to [ranking](../basics/ranking.html) *per content node*.
191-
Approximate search exposes exactly `targetHits` hits to `first-phase` ranking on every content node
192-
as long as `targetHits` hits are actually found and not filtered out afterwards.
188+
* **totalTargetHits**:
189+
The [totalTargetHits](../reference/querying/yql.html#totaltargethits) parameter
190+
specifies how many hits one wants to expose to [ranking](../basics/ranking.html) in total over the content nodes
191+
participating in the query (you can also set this per node using [targetHits](../reference/querying/yql.html#targethits)).
192+
Approximate search exposes exactly `totalTargetHits` hits to `first-phase` ranking over the content nodes
193+
as long as `totalTargetHits` hits are actually found and not filtered out.
193194
Nearest neighbor search is typically used as an efficient retriever in a [phased ranking](../ranking/phased-ranking.html)
194195
pipeline. See [performance sizing](../performance/sizing-search.html).
195196

0 commit comments

Comments
 (0)