algolia搜索
algolia有两个方式使用:
- 自行添加
CI脚本, 和crawlerConfig.json爬取数据 - 基于官方的
DocSearch来爬取数据
方式1
前期准备
注册
algolia账号, 并创建一个应用添加
crawlerConfig.json, 并添加以下内容:
json
{
"index_name": "My First Application",
"start_urls": ["https://mirwangjn.github.io/Note/"],
"rateLimit": 8,
"maxDepth": 10,
"selectors": {
"lvl0": {
"selector": "",
"defaultValue": "Documentation"
},
"lvl1": ".content h1",
"lvl2": ".content h2",
"lvl3": ".content h3",
"lvl4": ".content h4",
"lvl5": ".content h5",
"content": ".content p, .content li",
"lang": {
"selector": "/html/@lang",
"type": "xpath",
"global": true
}
},
"selectors_exclude": [
"aside",
".page-footer",
".next-and-prev-link",
".table-of-contents"
],
"custom_settings": {
"attributesForFaceting": ["lang", "tags"]
},
"js_render": true
}