Skip to main content

embed_document_with

Function embed_document_with 

Source
pub fn embed_document_with(
    text: &str,
    k1: f64,
    b: f64,
    avgdl: f64,
) -> SparseVector
Expand description

Embed document text with explicit BM25 parameters.

avgdl <= 0 or non-finite falls back to DEFAULT_AVGDL (it is a divisor). k1 and b are used as given — including non-finite values, which propagate as NaN weights — so prefer embed_document_with_params for fail-closed validation. Frequencies are counted per token ID: on the rare murmur3 collision two terms merge into one dimension with summed counts, which keeps output deterministic across runs (the server’s own per-string counting is randomized there, so collided IDs carry no cross-implementation contract).