-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.js
38 lines (34 loc) · 804 Bytes
/
search.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* jshint esversion: 11 */
const searchClient = algoliasearch('OTREKEN07W', '87b93b6f0dc0636263d5afb2e9d45888');
const search = instantsearch({
indexName: 'test_people',
searchClient,
});
search.addWidgets([
instantsearch.widgets.configure({
hitsPerPage: 40,
}),
instantsearch.widgets.searchBox({
container: '#search-box',
placeholder: 'Search for people',
}),
instantsearch.widgets.hits({
container: '#hits',
templates: {
item: `
<div>
<strong>{{firstname}} {{lastname}}</strong><br>
Zip code: {{zip_code}}
</div>
`,
},
}),
instantsearch.widgets.refinementList({
container: '#zip-code-filter',
attribute: 'zip_code',
limit: 5,
showMore: true,
showMoreLimit: 900,
}),
]);
search.start();