Skip to content

Commit cc95704

Browse files
committed
Update and share algolia crawler config
1 parent 4a0cdb4 commit cc95704

1 file changed

Lines changed: 103 additions & 0 deletions

File tree

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// https://vitepress.dev/reference/default-theme-search#crawler-config
2+
3+
new Crawler({
4+
appId: "WV3XO0QV2E",
5+
apiKey: "...",
6+
rateLimit: 8,
7+
startUrls: ['https://turms-im.github.io/docs/'],
8+
renderJavaScript: false,
9+
sitemaps: [],
10+
exclusionPatterns: [],
11+
ignoreCanonicalTo: false,
12+
discoveryPatterns: ['https://turms-im.github.io/docs/**'],
13+
schedule: 'at 00:00 every 1 day',
14+
actions: [
15+
{
16+
indexName: 'turms-imio',
17+
pathsToMatch: ['https://turms-im.github.io/docs/**'],
18+
recordExtractor: ({ $, helpers }) => {
19+
return helpers.docsearch({
20+
recordProps: {
21+
lvl1: '.content h1',
22+
content: '.content p, .content li',
23+
lvl0: {
24+
selectors: '',
25+
defaultValue: 'Documentation'
26+
},
27+
lvl2: '.content h2',
28+
lvl3: '.content h3',
29+
lvl4: '.content h4',
30+
lvl5: '.content h5'
31+
},
32+
indexHeadings: true
33+
})
34+
}
35+
}
36+
],
37+
initialIndexSettings: {
38+
vitepress: {
39+
attributesForFaceting: ['type', 'lang'],
40+
attributesToRetrieve: ['hierarchy', 'content', 'anchor', 'url'],
41+
attributesToHighlight: ['hierarchy', 'hierarchy_camel', 'content'],
42+
attributesToSnippet: ['content:10'],
43+
camelCaseAttributes: ['hierarchy', 'hierarchy_radio', 'content'],
44+
searchableAttributes: [
45+
'unordered(hierarchy_radio_camel.lvl0)',
46+
'unordered(hierarchy_radio.lvl0)',
47+
'unordered(hierarchy_radio_camel.lvl1)',
48+
'unordered(hierarchy_radio.lvl1)',
49+
'unordered(hierarchy_radio_camel.lvl2)',
50+
'unordered(hierarchy_radio.lvl2)',
51+
'unordered(hierarchy_radio_camel.lvl3)',
52+
'unordered(hierarchy_radio.lvl3)',
53+
'unordered(hierarchy_radio_camel.lvl4)',
54+
'unordered(hierarchy_radio.lvl4)',
55+
'unordered(hierarchy_radio_camel.lvl5)',
56+
'unordered(hierarchy_radio.lvl5)',
57+
'unordered(hierarchy_radio_camel.lvl6)',
58+
'unordered(hierarchy_radio.lvl6)',
59+
'unordered(hierarchy_camel.lvl0)',
60+
'unordered(hierarchy.lvl0)',
61+
'unordered(hierarchy_camel.lvl1)',
62+
'unordered(hierarchy.lvl1)',
63+
'unordered(hierarchy_camel.lvl2)',
64+
'unordered(hierarchy.lvl2)',
65+
'unordered(hierarchy_camel.lvl3)',
66+
'unordered(hierarchy.lvl3)',
67+
'unordered(hierarchy_camel.lvl4)',
68+
'unordered(hierarchy.lvl4)',
69+
'unordered(hierarchy_camel.lvl5)',
70+
'unordered(hierarchy.lvl5)',
71+
'unordered(hierarchy_camel.lvl6)',
72+
'unordered(hierarchy.lvl6)',
73+
'content'
74+
],
75+
distinct: true,
76+
attributeForDistinct: 'url',
77+
customRanking: [
78+
'desc(weight.pageRank)',
79+
'desc(weight.level)',
80+
'asc(weight.position)'
81+
],
82+
ranking: [
83+
'words',
84+
'filters',
85+
'typo',
86+
'attribute',
87+
'proximity',
88+
'exact',
89+
'custom'
90+
],
91+
highlightPreTag: '<span class="algolia-docsearch-suggestion--highlight">',
92+
highlightPostTag: '</span>',
93+
minWordSizefor1Typo: 3,
94+
minWordSizefor2Typos: 7,
95+
allowTyposOnNumericTokens: false,
96+
minProximity: 1,
97+
ignorePlurals: true,
98+
advancedSyntax: true,
99+
attributeCriteriaComputedByMinProximity: true,
100+
removeWordsIfNoResults: 'allOptional'
101+
}
102+
}
103+
});

0 commit comments

Comments
 (0)