You can retrieve results from an index using Spatie\SiteSearch\Search
.
##Getting all results
Here's how you can retrieve all results from an index named my-index
.
use Spatie\SiteSearch\Search;
$searchResults = Search::onIndex('my-index')
->query('your query')
->get();
##Limiting results
You can limit the amount of results using the limit
function.
use Spatie\SiteSearch\Search;
$searchResults = Search::onIndex('my-index')
->query('your query')
->limit(20)
->get();
##Paginating results
You can paginate results using by calling paginate
.
use Spatie\SiteSearch\Search;
$searchResults = Search::onIndex('my-index')
->query('your query')
->paginate(20);