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
$searchKey
this method restricts searches to the given 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 ships with Vue by default. You only have to addvue-instantsearch
as a dependency and register it as a Vue
plugin:
resources/js/app.js
and add the following lines just after the window.Vue = require('vue');
line:
app.js
bundle file while working on it, run:
Scaffold a search interface
The following example shows a small search interface with a minimal design. Since the template needs access to the application ID and API key, you need to move the Vue initialization into a Blade template.Blade