-
Notifications
You must be signed in to change notification settings - Fork 143
/
algolia-crawler-config.js
110 lines (110 loc) · 3.24 KB
/
algolia-crawler-config.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
new Crawler({
appId: "N5FBG9I0SH",
apiKey: "",
rateLimit: 8,
maxDepth: 10,
startUrls: [
"https://aframe.io/docs/master/introduction/",
"https://aframe.io/docs/0.1.0/guide/",
"https://aframe.io/docs/0.2.0/guide/",
"https://aframe.io/docs/0.3.0/introduction/",
"https://aframe.io/docs/0.4.0/introduction/",
"https://aframe.io/docs/0.5.0/introduction/",
"https://aframe.io/docs/0.6.0/introduction/",
"https://aframe.io/docs/0.7.0/introduction/",
"https://aframe.io/docs/0.8.0/introduction/",
"https://aframe.io/docs/1.0.0/introduction/",
"https://aframe.io/docs/1.1.0/introduction/",
"https://aframe.io/docs/1.2.0/introduction/",
"https://aframe.io/docs/1.3.0/introduction/",
"https://aframe.io/docs/1.4.0/introduction/",
"https://aframe.io/docs/1.5.0/introduction/",
"https://aframe.io/docs/1.6.0/introduction/",
],
renderJavaScript: false,
sitemaps: [],
ignoreCanonicalTo: true,
discoveryPatterns: ["https://aframe.io/docs/**"],
actions: [
{
indexName: "aframe",
pathsToMatch: ["https://aframe.io/docs/**"],
recordExtractor: ({ $, url, helpers }) => {
$(".mobile-header").remove();
$(".docs-header").remove();
return helpers.docsearch({
recordProps: {
lvl0: {
selectors: "",
defaultValue: "Documentation",
},
lvl1: [".content h1"],
lvl2: [".content h"],
lvl3: [".content h3"],
lvl4: [".content h4"],
lvl5: [".content h5"],
content: [".content p", ".content li", ".content td"],
version: {
defaultValue: url.pathname.split("/")[2],
},
},
aggregateContent: true,
recordVersion: "v2",
});
},
},
],
initialIndexSettings: {
aframe: {
attributesForFaceting: ["version"],
attributesToRetrieve: [
"hierarchy",
"content",
"anchor",
"url",
"url_without_anchor",
"type",
"version",
],
attributesToHighlight: ["hierarchy", "content"],
attributesToSnippet: ["content:10"],
camelCaseAttributes: ["hierarchy", "content"],
searchableAttributes: [
"unordered(hierarchy.lvl0)",
"unordered(hierarchy.lvl1)",
"unordered(hierarchy.lvl2)",
"unordered(hierarchy.lvl3)",
"unordered(hierarchy.lvl4)",
"unordered(hierarchy.lvl5)",
"unordered(hierarchy.lvl6)",
"content",
],
distinct: true,
attributeForDistinct: "url",
customRanking: [
"desc(weight.pageRank)",
"desc(weight.level)",
"asc(weight.position)",
],
ranking: [
"words",
"filters",
"typo",
"attribute",
"proximity",
"exact",
"custom",
],
highlightPreTag: '<span class="algolia-docsearch-suggestion--highlight">',
highlightPostTag: "</span>",
minWordSizefor1Typo: 3,
minWordSizefor2Typos: 7,
allowTyposOnNumericTokens: false,
minProximity: 1,
ignorePlurals: true,
advancedSyntax: true,
attributeCriteriaComputedByMinProximity: true,
removeWordsIfNoResults: "allOptional",
},
},
});