Skip to content

rankResults

rankResults(results, weights?, halfLifeDays?, now?): SemanticSearchResult[]

Defined in: packages/memory-ltm/src/rank.ts:61

Re-rank semantic search results using a blended similarity + recency + importance score. The returned array is a new array; input is not mutated. The score on each result is replaced with the blended value.

Ordering is deterministic: ties are broken by ascending memory id so that equal-scoring results produce a stable, reproducible sequence.

SemanticSearchResult[]

Raw hits from the vector store (any order).

RankingWeights = DEFAULT_RANKING_WEIGHTS

Relative weights (need not sum to 1; they are normalised).

number = 30

Recency half-life in calendar days (default 30).

Date = ...

Reference time for age calculation (default: Date.now()).

SemanticSearchResult[]