This is an automated email from the ASF dual-hosted git repository.
alessandrobenedetti pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_10x by this push:
new 3c27e9ca52e Ref guide - Improve docs for Dense Vector reranking
examples (#4532)
3c27e9ca52e is described below
commit 3c27e9ca52e95babdb5370628f80a12594aa6fa4
Author: Adam Quigley <[email protected]>
AuthorDate: Wed Jul 1 06:11:41 2026 -0400
Ref guide - Improve docs for Dense Vector reranking examples (#4532)
(cherry picked from commit d33bac878bec7659b69de3a32262fe6698c31098)
---
.../query-guide/pages/dense-vector-search.adoc | 34 ++++++++++++++++++++--
.../query-guide/pages/query-re-ranking.adoc | 3 ++
2 files changed, 34 insertions(+), 3 deletions(-)
diff --git
a/solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc
b/solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc
index db02ddceda1..381a33b5ee5 100644
--- a/solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc
+++ b/solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc
@@ -816,7 +816,37 @@ Some use cases where `includeTags` and/or `excludeTags`
may be more useful then
-=== Usage in Re-Ranking Query
+[[vector-reranking]]
+== Usage in Re-Ranking Query
+
+Dense vector similarity scores can be used to
xref:query-guide:query-re-ranking.adoc[re-rank] first pass query results.
+Possible use cases include:
+
+* Re-ranking approximate results from a quantized vector field using full
fidelity float vectors.
+* Re-ranking lexical search results with dense vector similarity scores.
+
+Details about using the ReRank Query Parser can be found in the
xref:query-guide:query-re-ranking.adoc[Query Re-Ranking] section.
+
+=== Re-Ranking with vectorSimilarity Function Query
+
+The
xref:query-guide:function-queries.adoc#vectorsimilarity-function[vectorSimilarity()]
function can be used with the `{!func}` query parser to re-rank by vector
similarity.
+When used as a function query, `vectorSimilarity()` computes the exact
similarity for only the candidate documents selected for re-ranking, without
traversing the index graph.
+
+Here is an example of re-ranking a lexical query using a `DenseVectorField`
named `vector`:
+
+[source,text]
+?q=title:phone&rq={!rerank reRankQuery=$rqq reRankDocs=100
reRankWeight=1}&rqq={!func}vectorSimilarity(vector,[1.0,2.0,3.0,4.0])
+
+NOTE: The default `reRankOperator` is `add`, which sums the first-pass score
and the vector similarity score.
+Since these scores may differ in magnitude, you can adjust `reRankWeight` to
control the balance between them, or use `reRankOperator=replace` to score
re-ranked documents by vector similarity alone.
+
+When using a quantized vector field type (such as
`ScalarQuantizedDenseVectorField`), the KNN first pass scores are computed on
the quantized vectors.
+Here is an example of re-ranking those results with exact float similarity
scores, where `topK` matches `reRankDocs`:
+
+[source,text]
+?q={!knn f=vector topK=100}[1.0,2.0,3.0,4.0]&rq={!rerank reRankQuery=$rqq
reRankDocs=100 reRankWeight=1
reRankOperator=replace}&rqq={!func}vectorSimilarity(vector,[1.0,2.0,3.0,4.0])
+
+=== Re-Ranking with knn Query Parser
Both dense vector search query parsers can be used to rerank first pass query
results:
@@ -834,8 +864,6 @@ the k-nearest neighbors(*in the whole index*) of the target
vector to search.
This means the second pass `knn` is executed on the whole index anyway, which
is a current limitation.
The final ranked list of results will have the first pass score(main query
`q`) added to the second pass score(the approximated similarityFunction
distance to the target vector to search) multiplied by a multiplicative
factor(reRankWeight).
-
-Details about using the ReRank Query Parser can be found in the
xref:query-guide:query-re-ranking.adoc[Query Re-Ranking] section.
====
diff --git
a/solr/solr-ref-guide/modules/query-guide/pages/query-re-ranking.adoc
b/solr/solr-ref-guide/modules/query-guide/pages/query-re-ranking.adoc
index 737ebef74af..598b966d115 100644
--- a/solr/solr-ref-guide/modules/query-guide/pages/query-re-ranking.adoc
+++ b/solr/solr-ref-guide/modules/query-guide/pages/query-re-ranking.adoc
@@ -134,6 +134,9 @@ In the example below, the scores for the top 1000 documents
matching the query "
q=phone&rq={!rerank reRankQuery=$rqq reRankDocs=1000 reRankWeight=1
reRankOperator=replace}&rqq={!func v=div(1,sum(1,price))}
----
+xref:query-guide:dense-vector-search.adoc[Dense vector fields] can also be
used for re-ranking via the
xref:query-guide:function-queries.adoc#vectorsimilarity-function[vectorSimilarity()]
function query.
+This computes exact vector similarity only for the re-ranked candidate
documents. See xref:query-guide:dense-vector-search.adoc#vector-reranking[Usage
in Re-Ranking Query] for examples and details.
+
=== LTR Query Parser