Utility functions for Datalevin adapter - query helpers.
Utility functions for Datalevin adapter - query helpers.
(fulltext-search db query)(fulltext-search db query {:keys [domains top limit offset]})Full-text search via Datalevin's built-in search engine. Returns
[[eid score] ...] in descending-score (most-relevant-first) order, deduped
by eid (best score kept). Raw scored matches — no Pathom, no ident
projection. This is the primitive the generated :<ns>/search resolver is
built on; use it directly for custom ranking, filtering, or batch work.
query is a string, a boolean expression vector like
[:and "x" [:not "y"]], or {:phrase "..."} (phrase search requires
the domain to be indexed with :index-position? true).
Options:
:domains — vector of search-domain strings to search within.:top — cap on engine results (Datalevin default 10).:limit / :offset — pagination within the result window.NOTE: ordering is obtained via {:display :refs+scores} plus an explicit
sort — Datalog's set semantics do NOT preserve the engine's rank order.
Full-text search via Datalevin's built-in search engine. Returns
`[[eid score] ...]` in descending-score (most-relevant-first) order, deduped
by eid (best score kept). Raw scored matches — no Pathom, no ident
projection. This is the primitive the generated `:<ns>/search` resolver is
built on; use it directly for custom ranking, filtering, or batch work.
`query` is a string, a boolean expression vector like
`[:and "x" [:not "y"]]`, or `{:phrase "..."}` (phrase search requires
the domain to be indexed with `:index-position? true`).
Options:
- `:domains` — vector of search-domain strings to search within.
- `:top` — cap on engine results (Datalevin default 10).
- `:limit` / `:offset` — pagination within the result window.
NOTE: ordering is obtained via `{:display :refs+scores}` plus an explicit
sort — Datalog's set semantics do NOT preserve the engine's rank order.(pull db pattern eid)Pull entity data from the database. Convenience wrapper around datalevin.core/pull.
Pull entity data from the database. Convenience wrapper around datalevin.core/pull.
(pull-many db pattern eids)Pull multiple entities from the database. Convenience wrapper around datalevin.core/pull-many.
Pull multiple entities from the database. Convenience wrapper around datalevin.core/pull-many.
(q query & args)Execute a Datalog query against the database. Convenience wrapper around datalevin.core/q.
Execute a Datalog query against the database. Convenience wrapper around datalevin.core/q.
(seed-database! conn data)Seed a database with initial data.
Arguments:
Returns the transaction result.
Seed a database with initial data. Arguments: - conn: Datalevin connection - data: vector of entity maps to transact Returns the transaction result.
(vec-attr-domain qualified-key)Convert a qualified keyword to a Datalevin vector domain string. Matches datalevin.vector/attr-domain: replaces '/' with '_' (each :db.type/vec attribute is automatically its own vector search domain).
Convert a qualified keyword to a Datalevin vector domain string. Matches datalevin.vector/attr-domain: replaces '/' with '_' (each :db.type/vec attribute is automatically its own vector search domain).
(vec-search db query-vector)(vec-search db query-vector {:keys [attribute domains top]})Nearest-neighbor search over :db.type/vec attributes. Returns
[[eid distance] ...] in ascending-distance (nearest-first) order, deduped
by eid (best distance kept). Raw scored neighbors — no Pathom, no ident
projection. This is the primitive the generated :<ns>/similar resolver is
built on; use it directly for custom ranking, filtering, or batch work.
Options:
:attribute — qualified keyword of a specific :vec attribute to search.:domains — vector of vector-domain strings (see vec-attr-domain);
used when :attribute is not given.:top — cap on engine results (Datalevin default 10).NOTE: ordering is obtained via {:display :refs+dists} plus an explicit
sort — Datalog's set semantics do NOT preserve the engine's rank order.
Nearest-neighbor search over `:db.type/vec` attributes. Returns
`[[eid distance] ...]` in ascending-distance (nearest-first) order, deduped
by eid (best distance kept). Raw scored neighbors — no Pathom, no ident
projection. This is the primitive the generated `:<ns>/similar` resolver is
built on; use it directly for custom ranking, filtering, or batch work.
Options:
- `:attribute` — qualified keyword of a specific `:vec` attribute to search.
- `:domains` — vector of vector-domain strings (see `vec-attr-domain`);
used when `:attribute` is not given.
- `:top` — cap on engine results (Datalevin default 10).
NOTE: ordering is obtained via `{:display :refs+dists}` plus an explicit
sort — Datalog's set semantics do NOT preserve the engine's rank order.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |