Memo::Queries
Abstract query interface for database-backend-specific SQL.
Each backend (SQLite, PostgreSQL) implements all query methods with SQL native to that backend. This avoids placeholder translation and keeps SQL explicit per backend.
Constructors
Class methods
Instance methods
Per chunk of a source: {content_id, pair_id, parent_id, source_type, whether its hash has an embedding, with a stored vector, for the service}
Remove a service's vectors, journal entries and journal state
Which of hashes have an embedding for the service with a stored
vector (one without has been lost: embed it again)
{embedding id, service id} for every service's embedding of a hash
Which of candidate_ids pass the filter clauses (looked up by id, so the
cost depends on the number of candidates, not the collection)
Same queries, run on one connection (for use inside a transaction).
{pruned_through, vectors_backfilled}
Distinct embedding ids logged after seq
Insert service with is_default and return ID (for ServiceProvider.create)
memo_texts rows (databases from before 0.13): {source_id, content, content_hash}
The mark_queue_* methods take the item's text as it was read, and do nothing if it has changed since: the source was queued again, and the newer text still needs embedding.
Delete a text unless a source or chunk still points at it
The id of the text with this hash, storing it if new. content nil
stores the hash alone.