Skip to main content

Crate ryu_search

Crate ryu_search 

Source
Expand description

Conversation search primitive: the sqlite-vec (vec0) semantic KNN index (MessageIndex) and the contentless FTS5 lexical index (MessageFtsIndex) over past chat messages. Both stores hold vectors / inverted-index + metadata only — never message text; the caller re-reads and decrypts each hit’s snippet from conversations.db.

§The embedder seam (SearchEmbedder)

The semantic index needs to turn text into vectors, but which embedder (local hashing vs. a registry-configured remote /v1/embeddings endpoint) is a per-consumer RAG concern that must stay out of this crate. So the embedder is injected as a narrow SearchEmbedder trait object at construction; Core wraps its retrieval::Embedder behind this in apps/core/src/search_host.rs. The crate never sees ModelRegistry and has ZERO dependency on apps/core.

The default db paths (~/.ryu/message-embeddings.db, ~/.ryu/message-fts.db) and the registry-driven embedder choice likewise stay Core-side (the host shim), mirroring the ryu-storage open(path) precedent.

Structs§

MessageFtsHit
A full-text hit from the message FTS index: the message_id + metadata + a bounded relevance score. The snippet/content is intentionally NOT stored here — the caller re-reads and decrypts it from conversations.db.
MessageFtsIndex
FTS5-backed full-text index of chat-message bodies. Cheap to clone (Arc inside). Stores only the tokenized inverted index + metadata; never retrievable message text.
MessageHit
A KNN hit from the message index: the message_id + its (squared L2) distance. The snippet/content is intentionally NOT stored here — the caller re-reads and decrypts it from conversations.db.
MessageIndex
sqlite-vec-backed index of chat-message embeddings. Cheap to clone (Arc inside). Stores vectors + metadata only; never message text.

Traits§

SearchEmbedder
Narrow embedding seam for the semantic message index. Core wraps its registry-configured retrieval::Embedder behind this trait so the crate never depends on the model registry (per-consumer embedder config is a RAG concern, a later decomposition wave).