|
1 | 1 | new Crawler({
|
2 |
| - appId: "KH7SY7AEUO", // imlyk 的 Algolia App ID |
3 |
| - apiKey: "c8df03a5a5e8ac753a318c6595fb6658", |
| 2 | + appId: "9JU9RU2AS7", |
| 3 | + indexPrefix: "", |
4 | 4 | rateLimit: 8,
|
5 |
| - startUrls: [ |
6 |
| - // 这是 Algolia 开始抓取网站的初始地址 |
7 |
| - // 如果你的网站被分为数个独立部分,你可能需要在此设置多个入口链接 |
8 |
| - "https://javashub.cn", "https://www.javashub.cn" |
9 |
| - ], |
10 |
| - sitemaps: [ |
11 |
| - // 如果你在使用 Sitemap 插件 (如: @vuepress/plugin-sitemap),你可以提供 Sitemap 链接 |
12 |
| - "https://javashub.cn/sitemap.xml", |
13 |
| - ], |
14 |
| - ignoreCanonicalTo: false, |
15 |
| - exclusionPatterns: [ |
16 |
| - // 你可以通过它阻止 Algolia 抓取某些 URL |
17 |
| - ], |
18 |
| - discoveryPatterns: [ |
19 |
| - // 这是 Algolia 抓取 URL 的范围 |
20 |
| - "https://javashub.cn/**", |
21 |
| - ], |
22 |
| - // 爬虫执行的计划时间,可根据文档更新频率设置 |
| 5 | + maxUrls: 300, |
23 | 6 | schedule: "at 02:00 every 1 day",
|
| 7 | + startUrls: ["https://javashub.cn/"], |
| 8 | + sitemaps: [], |
| 9 | + saveBackup: false, |
| 10 | + ignoreQueryParams: ["source", "utm_*"], |
24 | 11 | actions: [
|
25 |
| - // 你可以拥有多个 action,特别是你在一个域名下部署多个文档时 |
26 | 12 | {
|
27 |
| - // 使用适当的名称为索引命名 |
28 |
| - indexName: "javashub", |
29 |
| - // 索引生效的路径 |
30 |
| - pathsToMatch: [ |
31 |
| - "https://javashub.cn/**", |
32 |
| - "https://www.javashub.cn/**" |
33 |
| - ], |
34 |
| - // 控制 Algolia 如何抓取你的站点 |
35 |
| - recordExtractor: ({ $, helpers }) => { |
36 |
| - // 以下是适用于 vuepress-theme-hope 的默认选项选项 |
37 |
| - return helpers.docsearch({ |
38 |
| - recordProps: { |
39 |
| - lvl0: { |
40 |
| - selectors: [".vp-sidebar-link.active", "[vp-content] h1"], |
41 |
| - defaultValue: "Documentation", |
42 |
| - }, |
43 |
| - lvl1: "[vp-content] h1", |
44 |
| - lvl2: "[vp-content] h2", |
45 |
| - lvl3: "[vp-content] h3", |
46 |
| - lvl4: "[vp-content] h4", |
47 |
| - lvl5: "[vp-content] h5", |
48 |
| - lvl6: "[vp-content] h6", |
49 |
| - content: "[vp-content] p, [vp-content] ul, [vp-content] li", |
50 |
| - }, |
51 |
| - recordVersion: "v3", |
52 |
| - }); |
| 13 | + indexName: "javashub_cn_9ju9ru2as7_articles", |
| 14 | + pathsToMatch: ["https://javashub.cn/**", "https://www.javashub.cn/**"], |
| 15 | + recordExtractor: ({ url, $, helpers }) => { |
| 16 | + return helpers.article({ $, url }); |
| 17 | + }, |
| 18 | + }, |
| 19 | + { |
| 20 | + indexName: "javashub_cn_9ju9ru2as7_products", |
| 21 | + pathsToMatch: ["https://javashub.cn/**", "https://www.javashub.cn/**"], |
| 22 | + recordExtractor: ({ url, $, helpers }) => { |
| 23 | + return helpers.product({ $, url }); |
| 24 | + }, |
| 25 | + }, |
| 26 | + { |
| 27 | + indexName: "javashub_cn_9ju9ru2as7_pages", |
| 28 | + pathsToMatch: ["https://javashub.cn/**", "https://www.javashub.cn/**"], |
| 29 | + recordExtractor: ({ url, $, helpers, contentLength, fileType }) => { |
| 30 | + return helpers.page({ $, url, contentLength, fileType }); |
53 | 31 | },
|
54 | 32 | },
|
55 | 33 | ],
|
56 | 34 | initialIndexSettings: {
|
57 |
| - // 控制索引如何被初始化,这仅当索引尚未生成时有效 |
58 |
| - // 你可能需要在修改后手动删除并重新生成新的索引 |
59 |
| - YOUR_INDEX_NAME: { |
60 |
| - attributesForFaceting: ["type", "lang"], |
61 |
| - attributesToRetrieve: ["hierarchy", "content", "anchor", "url"], |
62 |
| - attributesToHighlight: ["hierarchy", "hierarchy_camel", "content"], |
63 |
| - attributesToSnippet: ["content:10"], |
64 |
| - camelCaseAttributes: ["hierarchy", "hierarchy_radio", "content"], |
| 35 | + javashub_cn_9ju9ru2as7_articles: { |
| 36 | + distinct: true, |
| 37 | + attributeForDistinct: "url", |
65 | 38 | searchableAttributes: [
|
66 |
| - "unordered(hierarchy_radio_camel.lvl0)", |
67 |
| - "unordered(hierarchy_radio.lvl0)", |
68 |
| - "unordered(hierarchy_radio_camel.lvl1)", |
69 |
| - "unordered(hierarchy_radio.lvl1)", |
70 |
| - "unordered(hierarchy_radio_camel.lvl2)", |
71 |
| - "unordered(hierarchy_radio.lvl2)", |
72 |
| - "unordered(hierarchy_radio_camel.lvl3)", |
73 |
| - "unordered(hierarchy_radio.lvl3)", |
74 |
| - "unordered(hierarchy_radio_camel.lvl4)", |
75 |
| - "unordered(hierarchy_radio.lvl4)", |
76 |
| - "unordered(hierarchy_radio_camel.lvl5)", |
77 |
| - "unordered(hierarchy_radio.lvl5)", |
78 |
| - "unordered(hierarchy_radio_camel.lvl6)", |
79 |
| - "unordered(hierarchy_radio.lvl6)", |
80 |
| - "unordered(hierarchy_camel.lvl0)", |
81 |
| - "unordered(hierarchy.lvl0)", |
82 |
| - "unordered(hierarchy_camel.lvl1)", |
83 |
| - "unordered(hierarchy.lvl1)", |
84 |
| - "unordered(hierarchy_camel.lvl2)", |
85 |
| - "unordered(hierarchy.lvl2)", |
86 |
| - "unordered(hierarchy_camel.lvl3)", |
87 |
| - "unordered(hierarchy.lvl3)", |
88 |
| - "unordered(hierarchy_camel.lvl4)", |
89 |
| - "unordered(hierarchy.lvl4)", |
90 |
| - "unordered(hierarchy_camel.lvl5)", |
91 |
| - "unordered(hierarchy.lvl5)", |
92 |
| - "unordered(hierarchy_camel.lvl6)", |
93 |
| - "unordered(hierarchy.lvl6)", |
94 |
| - "content", |
| 39 | + "unordered(keywords)", |
| 40 | + "unordered(title)", |
| 41 | + "unordered(description)", |
| 42 | + "url", |
95 | 43 | ],
|
| 44 | + customRanking: ["asc(depth)"], |
| 45 | + attributesForFaceting: ["category"], |
| 46 | + }, |
| 47 | + javashub_cn_9ju9ru2as7_products: { |
96 | 48 | distinct: true,
|
97 | 49 | attributeForDistinct: "url",
|
98 |
| - customRanking: [ |
99 |
| - "desc(weight.pageRank)", |
100 |
| - "desc(weight.level)", |
101 |
| - "asc(weight.position)", |
| 50 | + searchableAttributes: [ |
| 51 | + "unordered(name)", |
| 52 | + "unordered(description)", |
| 53 | + "url", |
102 | 54 | ],
|
103 |
| - ranking: [ |
104 |
| - "words", |
105 |
| - "filters", |
106 |
| - "typo", |
107 |
| - "attribute", |
108 |
| - "proximity", |
109 |
| - "exact", |
110 |
| - "custom", |
| 55 | + customRanking: ["asc(depth)"], |
| 56 | + attributesForFaceting: ["category"], |
| 57 | + }, |
| 58 | + javashub_cn_9ju9ru2as7_pages: { |
| 59 | + distinct: true, |
| 60 | + attributeForDistinct: "url", |
| 61 | + searchableAttributes: [ |
| 62 | + "unordered(keywords)", |
| 63 | + "unordered(title)", |
| 64 | + "unordered(description)", |
| 65 | + "url", |
111 | 66 | ],
|
112 |
| - highlightPreTag: |
113 |
| - '<span class="algolia-docsearch-suggestion--highlight">', |
114 |
| - highlightPostTag: "</span>", |
115 |
| - minWordSizefor1Typo: 3, |
116 |
| - minWordSizefor2Typos: 7, |
117 |
| - allowTyposOnNumericTokens: false, |
118 |
| - minProximity: 1, |
119 |
| - ignorePlurals: true, |
120 |
| - advancedSyntax: true, |
121 |
| - attributeCriteriaComputedByMinProximity: true, |
122 |
| - removeWordsIfNoResults: "allOptional", |
| 67 | + customRanking: ["asc(depth)"], |
| 68 | + attributesForFaceting: ["category"], |
123 | 69 | },
|
124 | 70 | },
|
| 71 | + apiKey: "3e81bda5968abae8996965fa0e491dd4", |
125 | 72 | });
|
0 commit comments