typesense/docsearchscraper 使用记录

概括:

1、使用 typesense/docsearch-scraper 抓取网站内容,制作索引
2、网站中添加 UI 组件,在搜索时请求制作的数据索引
3、定时抓取网站内容,更新索引

过程:

1、安装并运行 Typesense

docker pull typesense/typesense:0.22.1
export TYPESENSE_API_KEY=xyz
mkdir /tmp/typesense-data
docker run -p 8108:8108 -d -v/tmp/typesense-data:/data typesense/typesense:0.22.1 --data-dir /data --api-key=$TYPESENSE_API_KEY

Typesense 健康检查

curl http://localhost:8108/health

2、安装 jq

https://stedolan.github.io/jq/download/

centos:yum install jq

3、typesense - .env

vim /path/typesense/.env

TYPESENSE_API_KEY=xyz
TYPESENSE_HOST=xxx.a1.typesense.net
TYPESENSE_PORT=443
TYPESENSE_PROTOCOL=https

4、typesense - config.json

vim /path/typesense/config.json

config.json 内容格式参考【 https://github.com/algolia/docsearch-configs

5、安装并运行 typesense/docsearch-scraper

docker run -d --env-file=/path/typesense/.env -e "CONFIG=$(cat /path/typesense/config.json | jq -r tostring)" typesense/docsearch-scraper

let the world have no hard-to-write code ^-^
原文地址:https://www.cnblogs.com/ovim/p/15680843.html