-
Notifications
You must be signed in to change notification settings - Fork 338
Expand file tree
/
Copy pathapp.tsx
More file actions
35 lines (31 loc) · 907 Bytes
/
app.tsx
File metadata and controls
35 lines (31 loc) · 907 Bytes
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
import { autocomplete } from '@algolia/autocomplete-js';
import { createQuerySuggestionsPlugin } from '@algolia/autocomplete-plugin-query-suggestions';
import { liteClient as algoliasearch } from 'algoliasearch-v5/lite';
import '@algolia/autocomplete-theme-classic';
const appId = 'latency';
const apiKey = '6be0576ff61c053d5f9a3225e2a90f76';
const searchClient = algoliasearch(appId, apiKey);
const querySuggestionsPlugin = createQuerySuggestionsPlugin({
searchClient,
indexName: 'instant_search_demo_query_suggestions',
getSearchParams() {
return {
hitsPerPage: 10,
};
},
categoryAttribute: [
'instant_search',
'facets',
'exact_matches',
'categories',
],
itemsWithCategories: 1,
categoriesPerItem: 2,
});
autocomplete({
container: '#autocomplete',
placeholder: 'Search',
openOnFocus: true,
insights: true,
plugins: [querySuggestionsPlugin],
});