Because products are a native collection, we can make use of the search functionality by Statamic: https://statamic.dev/search​
Set up a search form in your antlers template, define a template for the results and you are finished.
​https://statamic.dev/search​
What about a live search? Well, lucky I did create an addon for this case.
It provides updated results as you type but is hooking into the Statamic search as well. Use the local driver, an algolia driver or whatever you prefer.
Whatever way you prefer, the main key is to configure those search indexes correctly. An example to get you started. Here we do have the default index for the page itself and a separate index for products. In your search you can leave out the index to serach through all indexes or define
default
or products
as index, to narrow down the search results.
// config/statamic/search.php​'default' => ['driver' => 'local','searchables' => ['collection:pages'],'fields' => ['title', 'url' ],],​'products' => ['driver' => 'algolia','searchables' => 'collection:products','fields' => ['title', 'url', 'price' ],
​https://statamic.com/addons/jonassiewertsen/live-search​