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 | |
---|---|
function1 |
A scoring function such as VectorDistance or FullTextScore. |
function2 |
A scoring function such as VectorDistance or FullTextScore. |
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]))
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, and can't be combined withORDER BY
on other property paths. - This function can’t be part of a projection (for example,
SELECT FullTextScore(c.text, "keyword") AS Score FROM c
is invalid.