You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc
+31-3Lines changed: 31 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -816,7 +816,37 @@ Some use cases where `includeTags` and/or `excludeTags` may be more useful then
816
816
817
817
818
818
819
-
=== Usage in Re-Ranking Query
819
+
[[vector-reranking]]
820
+
== Usage in Re-Ranking Query
821
+
822
+
Dense vector similarity scores can be used to xref:query-guide:query-re-ranking.adoc[re-rank] first pass query results.
823
+
Possible use cases include:
824
+
825
+
* Re-ranking approximate results from a quantized vector field using full fidelity float vectors.
826
+
* Re-ranking lexical search results with dense vector similarity scores.
827
+
828
+
Details about using the ReRank Query Parser can be found in the xref:query-guide:query-re-ranking.adoc[Query Re-Ranking] section.
829
+
830
+
=== Re-Ranking with vectorSimilarity Function Query
831
+
832
+
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.
833
+
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.
834
+
835
+
Here is an example of re-ranking a lexical query using a `DenseVectorField` named `vector`:
NOTE: The default `reRankOperator` is `add`, which sums the first-pass score and the vector similarity score.
841
+
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.
842
+
843
+
When using a quantized vector field type (such as `ScalarQuantizedDenseVectorField`), the KNN first pass scores are computed on the quantized vectors.
844
+
Here is an example of re-ranking those results with exact float similarity scores, where `topK` matches `reRankDocs`:
Both dense vector search query parsers can be used to rerank first pass query results:
822
852
@@ -834,8 +864,6 @@ the k-nearest neighbors(*in the whole index*) of the target vector to search.
834
864
This means the second pass `knn` is executed on the whole index anyway, which is a current limitation.
835
865
836
866
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).
837
-
838
-
Details about using the ReRank Query Parser can be found in the xref:query-guide:query-re-ranking.adoc[Query Re-Ranking] section.
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.
138
+
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.
0 commit comments