Pure document construction and filter-key conversion for search.
Key functions:
Pure document construction and filter-key conversion for search. Key functions: - defsearch — bind a SearchDefinition to a var (data only) - collect-definitions — the definitions a :wagoe/search component holds - api-enabled? — whether the generic search API serves an index - build-document* — construct a SearchDocument from field values - filter-key->json-key — convert a filter keyword to a snake_case JSON key
(api-enabled? definition)True when the generic search API may serve definition: it sets :api? true
or an :api :authorize fn. An :api map without one serves nothing, so a
misspelt key fails closed.
True when the generic search API may serve `definition`: it sets `:api? true` or an `:api :authorize` fn. An `:api` map without one serves nothing, so a misspelt key fails closed.
(build-document* definition entity-id field-values & [opts])Construct a SearchDocument from a SearchDefinition and field values using explicit runtime inputs.
Distributes field values to the correct weight buckets (A/B/C/D). Concatenates all text into :content-all for fallback LIKE search.
Args: definition - SearchDefinition map entity-id - UUID field-values - map of field-name -> string or seq value Seqs are joined with a space. opts - map with required :id and :updated-at, optional :metadata
Returns: SearchDocument map ready for ISearchStore.upsert-document!
Construct a SearchDocument from a SearchDefinition and field values using explicit runtime inputs.
Distributes field values to the correct weight buckets (A/B/C/D).
Concatenates all text into :content-all for fallback LIKE search.
Args:
definition - SearchDefinition map
entity-id - UUID
field-values - map of field-name -> string or seq value
Seqs are joined with a space.
opts - map with required :id and :updated-at, optional :metadata
Returns:
SearchDocument map ready for ISearchStore.upsert-document!(collect-definitions indexes contributed)The definitions a search component holds: indexes from its config and
contributed by modules, both maps of index id -> definition. A definition
without :id takes its key.
Returns {:definitions {…}}, or {:error {…}} when an id is set twice or a
definition's :id disagrees with its key.
The definitions a search component holds: `indexes` from its config and
`contributed` by modules, both maps of index id -> definition. A definition
without `:id` takes its key.
Returns `{:definitions {…}}`, or `{:error {…}}` when an id is set twice or a
definition's `:id` disagrees with its key.(defsearch var-name definition)Bind definition to var-name. Registers nothing: hand the var to
:wagoe/search, under :indexes in config or a module's :search part.
Bind `definition` to `var-name`. Registers nothing: hand the var to `:wagoe/search`, under `:indexes` in config or a module's `:search` part.
(filter-key->json-key k)Convert a filter keyword to a snake_case JSON object key.
:tenant-id -> "tenant_id" :status -> "status"
Used consistently by both build-document (storage) and the SQL query builders (retrieval) so that stored and queried keys always match.
Convert a filter keyword to a snake_case JSON object key. :tenant-id -> "tenant_id" :status -> "status" Used consistently by both build-document (storage) and the SQL query builders (retrieval) so that stored and queried keys always match.
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 |