Skip to content

Function: computeNormalizedRelevanceScores() ​

ts
function computeNormalizedRelevanceScores(candidates, queryText): ReadonlyMap<string, number>;

Defined in: postgres/src/stores/internal/compute-normalized-relevance.ts:38

Computes normalized BM25 + fuzzy/prefix relevance scores $R(L, Q) \in [0, 1]$ across candidates using MiniSearch.

Indexes directive and partition with { prefix: true, fuzzy: 0.2 }, returning 1.0 for all candidates when queryText is empty, score / maxScore when maxScore > 0, and 0 when a candidate does not match (SPEC.md §3.4.3).

Parameters ​

ParameterTypeDescription
candidatesreadonly RelevanceCandidateParams[]Candidate lessons to score.
queryTextstringSearch query text $Q$.

Returns ​

ReadonlyMap<string, number>

Map of candidate id to normalized relevance score $R(L, Q) \in [0, 1]$.

Released under the MIT License.