Skip to content

Function: computeNormalizedRelevance() ​

ts
function computeNormalizedRelevance(
   directive, 
   queryText, 
   partition?
): number;

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

Computes normalized text relevance $R(L, Q) \in [0, 1]$ between a single lesson directive and queryText via MiniSearch.

Returns 1 when queryText is empty or matches directive under BM25 + prefix/fuzzy search, and 0 when no terms match.

Parameters ​

ParameterTypeDescription
directivestringLesson directive text $L$.
queryTextstringSearch query text $Q$.
partition?stringOptional partition identifier associated with the lesson.

Returns ​

number

Normalized similarity score $R(L, Q) \in [0, 1]$.

Released under the MIT License.