-
-
Notifications
You must be signed in to change notification settings - Fork 381
/
algolia.backup.js
200 lines (196 loc) · 6.19 KB
/
algolia.backup.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
new Crawler({
appId: "90UJMUR5MX",
apiKey: "9a998d1fe84383f49cdb3f0e5aaa6a9e",
rateLimit: 8,
startUrls: [
"https://statamic.dev/modifiers/",
"https://statamic.dev/",
"https://statamic.dev/variables/",
"https://statamic.dev/quick-start",
],
renderJavaScript: false,
sitemaps: ["https://statamic.dev/sitemap.xml"],
exclusionPatterns: [
"https://statamic.dev/fieldtypes",
"https://statamic.dev/knowledge-base",
"https://statamic.dev/tags",
"https://statamic.dev/modifiers",
],
ignoreCanonicalTo: false,
discoveryPatterns: ["https://statamic.dev/**"],
schedule: "at 15:40 on Friday",
actions: [
{
indexName: "statamic_3",
pathsToMatch: ["https://statamic.dev/modifiers/**"],
recordExtractor: ({ $, helpers }) => {
// Removing DOM elements we don't want to crawl
const toRemove = ".ignored, .deprecated";
$(toRemove).remove();
return helpers.docsearch({
recordProps: {
lvl1: "#content h2",
content:
"#content article p,#content article li,#content article blockquote",
lvl0: {
selectors: "#content h1",
},
},
indexHeadings: true,
aggregateContent: true,
recordVersion: "v3",
});
},
},
{
indexName: "statamic_3",
pathsToMatch: ["https://statamic.dev/variables/**"],
recordExtractor: ({ $, helpers }) => {
// Removing DOM elements we don't want to crawl
const toRemove = ".ignored, .deprecated";
$(toRemove).remove();
return helpers.docsearch({
recordProps: {
lvl1: "#content h2",
content:
"#content article p,#content article li,#content article blockquote",
lvl0: {
selectors: "#content h1",
},
},
indexHeadings: true,
aggregateContent: true,
recordVersion: "v3",
});
},
},
{
indexName: "statamic_3",
pathsToMatch: ["https://statamic.dev/quick-start**/**"],
recordExtractor: ({ $, helpers }) => {
// Removing DOM elements we don't want to crawl
const toRemove = ".ignored, .deprecated";
$(toRemove).remove();
return helpers.docsearch({
recordProps: {
lvl1: "#content h2",
content:
"#content header p,#content article p,#content article li,#content article blockquote",
lvl0: {
selectors: "#content h1",
},
lvl2: "#content h3",
lvl3: "#content h4",
lvl4: "#content h5",
lvl5: "#content h6",
pageRank: "5",
},
indexHeadings: true,
aggregateContent: true,
recordVersion: "v3",
});
},
},
{
indexName: "statamic_3",
pathsToMatch: [
"https://statamic.dev**/**",
"!https://statamic.dev/modifiers/**",
"!https://statamic.dev/variables/**",
"!https://statamic.dev/quick-start**/**",
],
recordExtractor: ({ $, helpers }) => {
// Removing DOM elements we don't want to crawl
const toRemove = ".ignored, .deprecated";
$(toRemove).remove();
return helpers.docsearch({
recordProps: {
lvl1: "#content h2",
content:
"#content header p,#content article p,#content article li,#content article blockquote",
lvl0: {
selectors: "#content h1",
},
lvl2: "#content h3",
lvl3: "#content h4",
lvl4: "#content h5",
lvl5: "#content h6",
},
indexHeadings: true,
aggregateContent: true,
recordVersion: "v3",
});
},
},
],
initialIndexSettings: {
statamic_3: {
attributesForFaceting: ["type", "lang"],
attributesToRetrieve: ["hierarchy", "content", "anchor", "url"],
attributesToHighlight: ["hierarchy", "hierarchy_camel", "content"],
attributesToSnippet: ["content:10"],
camelCaseAttributes: ["hierarchy", "hierarchy_radio", "content"],
searchableAttributes: [
"unordered(hierarchy_radio_camel.lvl0)",
"unordered(hierarchy_radio.lvl0)",
"unordered(hierarchy_radio_camel.lvl1)",
"unordered(hierarchy_radio.lvl1)",
"unordered(hierarchy_radio_camel.lvl2)",
"unordered(hierarchy_radio.lvl2)",
"unordered(hierarchy_radio_camel.lvl3)",
"unordered(hierarchy_radio.lvl3)",
"unordered(hierarchy_radio_camel.lvl4)",
"unordered(hierarchy_radio.lvl4)",
"unordered(hierarchy_radio_camel.lvl5)",
"unordered(hierarchy_radio.lvl5)",
"unordered(hierarchy_radio_camel.lvl6)",
"unordered(hierarchy_radio.lvl6)",
"unordered(hierarchy_camel.lvl0)",
"unordered(hierarchy.lvl0)",
"unordered(hierarchy_camel.lvl1)",
"unordered(hierarchy.lvl1)",
"unordered(hierarchy_camel.lvl2)",
"unordered(hierarchy.lvl2)",
"unordered(hierarchy_camel.lvl3)",
"unordered(hierarchy.lvl3)",
"unordered(hierarchy_camel.lvl4)",
"unordered(hierarchy.lvl4)",
"unordered(hierarchy_camel.lvl5)",
"unordered(hierarchy.lvl5)",
"unordered(hierarchy_camel.lvl6)",
"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",
synonyms: [
["js", "javascript"],
["views", "templates"],
],
},
},
});