Memo::Queries::Postgres
Inherits Memo::Queries < Reference < Object
Class methods
Number the clauses' ? placeholders $N, continuing after after.
Returns the clauses and the last number used. Skips quoted strings
('...', "...", $tag$...$tag$) and comments, so a literal ? in caller
SQL (sql_where) isn't taken for a placeholder. That is also why the
jsonb ?, ?| and ?& operators can't appear in sql_where on Postgres:
use jsonb_exists, jsonb_exists_any and jsonb_exists_all instead.
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.