What it does
avo-advanced_search
Let anyone on your team jump to any record from anywhere in the app. This
Rails search gem puts a command palette behind Cmd + K that searches across every Avo
resource at once, with a quick-results dropdown and a full results page, all
driven by the same self.search
config you already write on each resource.
Results are keyboard-first: arrow keys to move, Enter to open, Esc to close,
with matches highlighted as you type. Tune each result's title, description,
avatar, and destination through the resource's item
block, branch your query on the search_type
local so the palette searches differently from the index, and plug in custom
providers that return plain hashes instead of Active Record relations. Your
agent writes the search config; the palette and its keyboard handling come with the gem.
See it in action
What you get
- Cmd + K command palette that searches every search-enabled resource at once
- Quick-results dropdown plus a dedicated full results page
- Keyboard navigation: arrow keys to move, Enter to open, Esc to close, with matches highlighted
-
Per-result title, description, avatar, image format (
:circle,:square,:rounded), and path via theitemblock -
search_typelocal (:global/:resource/:association) to scope the palette differently from index search - Custom search providers that return plain hashes instead of Active Record relations
-
hide_on_globalto keep a resource out of the palette while leaving its index search on
Why it pays off
- Ship a cross-resource command palette this afternoon instead of generating the Hotwire dropdown, keyboard handling, and highlighting from scratch.
-
Built on the same
self.searchconfig across the palette, index, and association pickers, so you write the query logic once, not three times. - Every Avo release makes it better: the search UI keeps working as you add resources and upgrade Avo, and fixes reach your app with bundle update.
- The same palette in every app your agents build, instead of a different search UI generated each time.
Questions
Which search backend does it use?
Yours. Each resource's self.search holds a query proc, and the palette runs whatever is in it: a ransack predicate (the docs' default, not a requirement), a pg_search scope, or a call to an external service such as Elasticsearch through a custom provider that returns plain hashes.
How is it different from the search on each resource?
Each resource's own search bar comes with Avo. Global Search adds the Cmd+K palette that queries every resource at once, with a result count per resource and a full results page, on top of the same self.search config, so you write each query once.
Can I keep a resource out of global search?
Yes. Set hide_on_global: true and the resource stays out of the palette while its own search on your resource Index view keeps working. The search_type local also lets one query behave differently in the palette and on the Index view.