jonassiewertsen/statamic-live-search
A Statamic addon for instant, as-you-type live search. Add a search field to your frontend and get fast results from configurable collections through a simple endpoint, with minimal setup and easy customization.
This release is a compatibility drop: it adds Statamic v6 and Laravel 13 support and types the $q property on the Search component. There are no new APIs and no deprecations, so the getting-started path is unchanged whether you're on v3.1 or v3.2.
composer require <vendor>/<package> — the constraint now resolves against statamic/cms:^6.0 and laravel/framework:^13.0. On Statamic 5 / Laravel 11–12, pin ^3.1 until you upgrade the host app.php artisan vendor:publish --tag=<package>-config) and read it first — the index/collection handles live there, and that's the file that answers 80% of "why isn't my entry showing up" questions.$q, and render results. That single-wire-up is the fastest way to confirm the install is healthy before you customize anything.Where to look first: the component class itself (it's the public contract for anything you extend), then the config, then the indexing code path.
Component-per-surface, not per-page. Instantiate the Search component once in the layout and pass context (collection handle, filters, result limit) as props. Re-instantiating per template fragments your query state and makes $q resets feel random.
Bind $q live, debounce in the input. wire:model.live.debounce.300ms="q" is the sane default. Keep the component's updatedQ() hook as the single place results are recomputed — don't scatter query logic across Blade and PHP.
Treat $q as the untrusted-input boundary. Trim, length-cap, and sanitize it before it hits the index driver. Search endpoints are the classic place where a raw user string becomes a wildcard query that scans the whole corpus.
Index on the write path, rebuild on deploy. If the package exposes events on entry save/publish, subscribe to them rather than running a full re-index on a schedule. Add the full rebuild to your deploy script so content-model changes (new fields, new collections) don't silently drop out of results.
Extend by subclassing the component, not forking it. Add typed properties and methods to your own subclass; keep the render view override in your theme. This is what makes the Laravel 13 / Statamic 6 jump survivable.
Test the search contract, not the index. Assert that a known entry for a known term appears in the top N — run it against a small fixture index in CI. Full-corpus assertions are flaky and slow.
$q type declaration can break your subclass. PHP property types are invariant: if you extended the Search component and redeclared public $q; (untyped) or typed it as ?string, v3.2 is a fatal error, not a warning. Grep your codebase for $q overrides before upgrading. If you must redeclare, match the parent type exactly.null a TypeError. If $q is now string, any wire:model binding, query string (?q=), or programmatic $component->q = null that previously worked on an untyped property will now throw. Coerce at the boundary: $this->q = (string) $request->query('q', '').$q, either version the cache key by package version or flush the search cache on deploy; otherwise a working upgrade looks broken for hours.$q (dump it) → does the driver return hits → does the view render them. Most "search is broken" reports stop at step one.Verdict: low-risk upgrade if you don't subclass the component. Ship it, but pair it with an index rebuild and a smoke test on your most common query.
How can I help you explore Laravel packages today?