Generate search keys
With client-side implementations, only use search API keys. Scout Extended provides thesearchKey method to generate a search key for each searchable class:
PHP
Searchable class,
and no other Searchable classes.
The
searchKey method uses the application cache to return the same search key until its expiry,
24 hours after generation.Integration with Vue InstantSearch
Scout Extended doesn’t dictate which JavaScript solution to use. You’re free to pick your favorite InstantSearch flavor. The example below covers the Vue InstantSearch integration.Install Vue InstantSearch
Laravel doesn’t ship with a frontend framework, so install Vue with the Vite plugin, then addvue-instantsearch and algoliasearch as dependencies:
Command line
vite.config.js file:
vite.config.js
resources/js/app.js file, create the Vue app, and register InstantSearch:
resources/js/app.js
Command line
Scaffold a search interface
The following example shows a small search interface with a minimal design. Since the frontend needs access to the and , expose them from your Blade template before loading the bundle:Blade