var client = algoliasearch("WT7ZONTAP8","2f26bc0d161a16e737f2d2c2f79148b4");
var index = client.initIndex("index-first");
autocomplete('#search-input-element-id', { hint: false }, [
{
source: autocomplete.sources.hits(index, { hitsPerPage: 10 }),
displayKey: 'title',
templates: {
suggestion: function(suggestion) {
return suggestion._highlightResult.title.value;
},
empty: function(suggestion) {
return 'No result';
}
}
}
]).on("autocomplete:selected",function(event, suggestion, dataset, context) {
console.log(event, suggestion, dataset, context);
window.location.assign(suggestion.url);
});