SearchAsh.GlobalIndex.Preparations.GlobalSearch (search_ash v0.4.2)

Copy Markdown View Source

Preparation for a SearchAsh.GlobalIndex resource's :global_search action.

Hides archived rows (unless include_archived?: true), restricts to the given types (when non-empty), then branches on the query term:

  • blank/absent term — list the matching rows, unfiltered and unranked (a list UI before the user types);
  • a term whose tokens are all eliminated (stopwords, too short: "de") — no results, rather than the pre-0.4.0 behaviour of silently listing everything;
  • otherwise — filter on the tsvector match (plus, with fuzzy? true, a trigram similarity/substring match on the folded label) and rank: label exact > starts-with > contains > body match (label_match_tier), then ts_rank, then primary key.

Summary

Functions

init(opts)

Callback implementation for Ash.Resource.Preparation.init/1.

supports(opts)

Callback implementation for Ash.Resource.Preparation.supports/1.