Skip to main content

apply_query

Function apply_query 

Source
pub fn apply_query(
    universe: &[MemoryRecord],
    query: &MemoryQuery,
    now: DateTime<Utc>,
) -> Vec<MemoryRecord>
Expand description

Apply query to a universe of records (one tenant’s namespace), pure: the superseded set is computed over the universe, then every declared filter runs through MemoryQuery::matches. Both store backends share this function — the JSON backend scans and applies it directly; Postgres pre-filters on columns and applies the same function to the reduced set, so filter semantics live in exactly one place.

The superseded set has two halves. A record is superseded when another record names it in supersedes (the wave-1 rule) — or, from wave 2, when a summary record names it in MemoryEvidence::source_memory_ids: consolidation supersedes the records it distills, and the naming is the same one dependent-summary invalidation walks on forgetting.