Engram::Search
Ranks the memories materialized in a Store's SQLite cache: FTS5 bm25 full-text search blended with a recency boost, optionally fused with brute-force cosine similarity over embeddings (Reciprocal Rank Fusion) when both an embedder and stored embeddings are available.
Store deliberately exposes only CRUD (no raw FTS5/bm25 query surface), so
Search opens its own independent connection to the same sqlite file — the
pattern spec/store_spec.cr already establishes with its raw_match helper.
Point Search.new at the same db_path used to build the Store.
Constants
Recency boost weight: recency_boost = w * (id - oldest) / (newest - oldest) (spec-mandated, w = 1.0).
Reciprocal Rank Fusion smoothing constant (spec-mandated).
Characters kept in a snippet before truncation.
Constructors
Instance methods
Newest-first memories, optionally filtered by topic. Superseded memories are
excluded unless include_superseded is true. score on each result is its recency boost.
Full-text search over memories: bm25-ranked and recency-boosted, and RRF-fused
with cosine similarity over embeddings when the store has them and an embedder
was supplied. A blank/whitespace query degrades to newest-first (like recent);
a non-blank query with no matchable token (e.g. all-CJK, pure punctuation) returns
no matches. Superseded memories are excluded unless include_superseded is true.