1
1
const client = algoliasearch ( 'UINQ2M4D9S' , '636b6d9e2dfb207e89ea7344859848f9' ) ;
2
- const players = client . initIndex ( 'segment-docs' ) ;
2
+ const docs = client . initIndex ( 'segment-docs' ) ;
3
3
4
4
autocomplete (
5
- '#autocomplete' ,
6
- {
5
+ '#autocomplete' , {
7
6
debug : true ,
8
- keyboardShortcuts : [ 's' , 191 ] ,
7
+ keyboardShortcuts : [ 's' , 191 ] ,
9
8
templates : {
10
- dropdownMenu :
11
- '<div class="aa-dataset-article"></div>'
9
+ dropdownMenu : '<div class="aa-dataset-article"></div>'
12
10
} ,
13
11
} ,
14
- [
15
- {
16
- source : autocomplete . sources . hits ( players , { hitsPerPage : 7 } ) ,
17
- displayKey : 'title' ,
18
- name : 'article' ,
19
- templates : {
20
- suggestion ( { _highlightResult, headings, url, anchor, _snippetResult, content} ) {
21
- if ( anchor != null ) {
22
- var anchorLink = "#" + anchor ;
23
- } else {
24
- var anchorLink = "" ;
25
- }
26
- return `<a class="aa-link" href="/docs${ url } ${ anchorLink } ">
12
+ [ {
13
+ source : autocomplete . sources . hits ( docs , {
14
+ hitsPerPage : 7 ,
15
+ facetFilters : [ 'hidden:-true' ] ,
16
+ } ) ,
17
+ displayKey : 'title' ,
18
+ name : 'article' ,
19
+ templates : {
20
+ suggestion ( {
21
+ _highlightResult,
22
+ headings,
23
+ url,
24
+ anchor,
25
+ _snippetResult,
26
+ content
27
+ } ) {
28
+ if ( anchor != null ) {
29
+ var anchorLink = "#" + anchor ;
30
+ } else {
31
+ var anchorLink = "" ;
32
+ }
33
+ return `<a class="aa-link" href="/docs${ url } ${ anchorLink } ">
27
34
<p class="aa-title" >${ _highlightResult . title . value } </h3>
28
35
<p class="aa-heading">${ headings . join ( ' >' ) } </p>
29
36
<p class="aa-content">${ _snippetResult . content . value } </p></a>
30
37
` ;
31
- } ,
32
- empty : '<div class="aa-empty">No matching results</div>' ,
33
38
} ,
39
+ empty : '<div class="aa-empty">No matching results</div>' ,
34
40
} ,
35
- ]
41
+ } , ]
36
42
) ;
37
43
38
- window . addEventListener ( '/' , ( e ) => {
39
- window . scrollTo ( 0 , 0 ) ;
40
- } ) ;
44
+ window . addEventListener ( '/' , ( e ) => {
45
+ window . scrollTo ( 0 , 0 ) ;
46
+ } ) ;
0 commit comments