Building a site
Search
Search live pages with Laravel Scout, per site and language.
The engine
Pages are indexed with Laravel Scout: title, summary, SEO fields and the text of every block, per language. Without a search service, Aurora's database engine is used: MySQL and MariaDB get full-text search with relevance, and other databases a simple match. Any Scout driver works too: set SCOUT_DRIVER to meilisearch, typesense or algolia, then import.
On the website
Page::search() searches the live pages anyone may see on the site the visitor is on, worked out from the address, most relevant first:
use Aurora\Models\Page;
$results = Page::search('fjord')->paginate(10);
// Add to it as with any Scout search: the limits stay.
Page::search('fjord')->query(fn ($query) => $query->with('author'))->get();
// Another site's pages, named.
Page::searchSite('fjord', site: $site)->get();
Chaining ->query() adds eager loading without lifting the limits: drafts and other sites' pages never come back.
In the admin
Settings › Search & SEO tries searches and reindexes, and each page shows what the index holds for it. People who manage search can leave a page out. The REST and GraphQL APIs offer the same search.
Rebuilding the index
Pages are indexed whenever they're saved. After importing content, changing pages outside the admin or moving to another search service, rebuild every page's entry with php artisan aurora:reindex: every site, or one with --site. Pages visitors can't find, such as drafts, are taken out of the index.
$ php artisan aurora:reindex
$ php artisan aurora:reindex --site=shop # one site's pages