Edit

Share via


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>, ..., <weights>)

Arguments

Description
function1 A scoring function such as VectorDistance or FullTextScore.
function2 A scoring function such as VectorDistance or FullTextScore.
weights An array of numbers defining an importance weight for each scoring function.

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]))

This example shows fusion with two VectorDistance functions

Remarks