Scrypath.Query (scrypath v0.3.5)

Copy Markdown View Source

%Scrypath.Query{} is internal normalized query state produced by the common search path before a backend sees it. It is not a semver-stable pattern-match target for application code—callers should build options as keywords for Scrypath.search/3 and treat this struct as an implementation detail behind Scrypath.Meilisearch.Query (or other adapters).

Summary

Types

Per-attribute facet bucket filters (facet_filter: keyword).

Facet attribute names requested on the query.

Meilisearch filter list after normalization (keyword of attribute predicates).

Normalized pagination: :number is the 1-based page index, :size is the page size cap.

Meilisearch sort list after normalization ([{attribute, direction}]).

t()

Internal query bundle: full-text string plus normalized filter, sort, facet, and per-query slices. Field shapes mirror allowlisted Scrypath.search/3 options after validation.

Types

facet_filter_t()

@type facet_filter_t() :: keyword()

Per-attribute facet bucket filters (facet_filter: keyword).

facets_t()

@type facets_t() :: [atom()]

Facet attribute names requested on the query.

filter_t()

@type filter_t() :: keyword()

Meilisearch filter list after normalization (keyword of attribute predicates).

page_t()

@type page_t() :: %{
  optional(:number) => pos_integer(),
  optional(:size) => pos_integer()
}

Normalized pagination: :number is the 1-based page index, :size is the page size cap.

sort_t()

@type sort_t() :: keyword()

Meilisearch sort list after normalization ([{attribute, direction}]).

t()

@type t() :: %Scrypath.Query{
  facet_filter: facet_filter_t(),
  facets: facets_t(),
  filter: filter_t(),
  page: page_t(),
  per_query: map(),
  sort: sort_t(),
  text: String.t()
}

Internal query bundle: full-text string plus normalized filter, sort, facet, and per-query slices. Field shapes mirror allowlisted Scrypath.search/3 options after validation.

Functions

new(text, opts)

@spec new(
  String.t(),
  keyword()
) :: t()