# Global Search

A Rails search palette: find any record across every resource with Cmd+K.

![Global Search screenshot](https://avohq.io/assets/addons/global-search/global-search-c229f1a0ec6a2964e665794b976b310adca5c80120b3e843f60d92479216299b.png)

- Price: $20/month
- Gem: `gem "avo-advanced_search"`
- Web page: https://avohq.io/addons/global-search
- Pricing: https://avohq.io/pricing.md

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

![Global Search overview](https://avohq.io/assets/addons/global-search/shot-1-00b93a68d15a785bc4c00c4293ba815aaf77a96f2a90e6b5c3e6770f2f1a74dd.png)

![Global Search detail](https://avohq.io/assets/addons/global-search/shot-2-00b93a68d15a785bc4c00c4293ba815aaf77a96f2a90e6b5c3e6770f2f1a74dd.png)

## 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 the `item` block
- `search_type` local (`: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_global` to 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.search` config 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.

Included in bundles: Essentials ($75/month)
