Skip to content

Commit 6fbd051

Browse files
committed
don't show hidden
1 parent 3933576 commit 6fbd051

File tree

1 file changed

+31
-25
lines changed

1 file changed

+31
-25
lines changed

src/assets/algolia.js

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,46 @@
11
const client = algoliasearch('UINQ2M4D9S', '636b6d9e2dfb207e89ea7344859848f9');
2-
const players = client.initIndex('segment-docs');
2+
const docs = client.initIndex('segment-docs');
33

44
autocomplete(
5-
'#autocomplete',
6-
{
5+
'#autocomplete', {
76
debug: true,
8-
keyboardShortcuts: ['s',191],
7+
keyboardShortcuts: ['s', 191],
98
templates: {
10-
dropdownMenu:
11-
'<div class="aa-dataset-article"></div>'
9+
dropdownMenu: '<div class="aa-dataset-article"></div>'
1210
},
1311
},
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}">
2734
<p class="aa-title" >${_highlightResult.title.value}</h3>
2835
<p class="aa-heading">${headings.join(' >')}</p>
2936
<p class="aa-content">${_snippetResult.content.value}</p></a>
3037
`;
31-
},
32-
empty: '<div class="aa-empty">No matching results</div>',
3338
},
39+
empty: '<div class="aa-empty">No matching results</div>',
3440
},
35-
]
41+
}, ]
3642
);
3743

38-
window.addEventListener('/', (e)=>{
39-
window.scrollTo(0,0);
40-
});
44+
window.addEventListener('/', (e) => {
45+
window.scrollTo(0, 0);
46+
});

0 commit comments

Comments
 (0)