RRF (NoSQL query)
APPLIES TO: NoSQL
This system function is used to combine two or more scores provided by other functions.
Syntax
RRF(<function1>, <function2, ...>)
Arguments
Description | |
---|---|
property_path |
The property path to search. |
array_expr |
A nonempty array of string literals. |
Examples
This is an example of Hybrid Search (vector similarity search + BM25 full text scoring).
SELECT TOP 10 *
FROM c
ORDER BY RANK RRF(FullTextScore(c.text, ["keyword"]), VectorDistance(c.vector, [1,2,3]))
This example shows fusion with two FullTextScore
functions
SELECT TOP 10 *
FROM c
ORDER BY RANK RRF(FullTextScore(c.text, ["keyword1"]), FullTextScore(c.text, ["keyword2"])
This example shows fusion with two VectorDistance
functions
SELECT TOP 5 *
FROM c
ORDER BY RANK RRF(VectorDistance(c.vector1, [1,2,3]),VectorDistance(c.vector2, [2,2,4,4]))
Remarks
- This function requires enrollment in the Azure Cosmos DB NoSQL Full Text Search preview feature.
- Hybrid Search also requires enrollment in Azure Cosmos DB NoSQL Vector Search.
- This function requires a Full Text Index.
- This function can only be used in an
ORDER BY RANK
clause. - This function can’t be part of a projection (for example,
SELECT FullTextScore(c.text, "keyword") AS Score FROM c
is invalid.