Liking cljdoc? Tell your friends :D

wagoe.search.core.index

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
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
raw docstring

api-enabled?clj

(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.
sourceraw docstring

build-document*clj

(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!
sourceraw docstring

collect-definitionsclj

(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.
sourceraw docstring

defsearchcljmacro

(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.
sourceraw docstring

filter-key->json-keyclj

(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.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close