rankDocuments

open override fun rankDocuments(query: String): Flow<RankedDocument<Document>>(source)

Ranks documents based on their similarity to a given query string.

This method computes a similarity score for each document relative to the provided query by embedding both the query and the stored document, and then comparing their vector representations. The result is a flow of ranked documents, each associated with a similarity score.

Return

A flow of RankedDocument objects, where each object contains a document and its associated similarity score.

Parameters

query

The query string used to rank the documents.