当前位置 : 主页 > 编程语言 > java >

【Rust 日报】2021-07-18 -- Quickwit 高性能对象存储搜索引擎

来源:互联网 收集:自由互联 发布时间:2022-06-22
Quickwit:亚秒级延迟的对象存储搜索引擎 如果用过 ES,会感到非常熟悉,具体包括以下步骤: 第一步:编写索引配置文件​​wiki_index_config.json​​(以 wiki 为例),保存到当前目录:

Quickwit:亚秒级延迟的对象存储搜索引擎

如果用过 ES,会感到非常熟悉,具体包括以下步骤:

第一步:编写索引配置文件 ​​wiki_index_config.json​​(以 wiki 为例),保存到当前目录:

{
"default_search_fields": ["body", "title"], // If you do not specify fields in your query, those fields will be used.
"field_mappings": [
{
"name": "body",
"type": "text"
},
{
"name": "title",
"type": "text"
},
{
"name": "url",
"type": "text",
"indexed": false, // Field not indexed, you will not be able to search on this field.
"stored": false // Field not stored.
}
]
}

第二步:创建索引:

$ ./quickwit new --index-uri file:///$(pwd)/wikipedia --index-config-path ./wiki_index_config.json

其中,​​wikipedia​​ 是空文件夹

第三步:添加一些文档(需提前下载文档文件到当前目录):

./quickwit index --index-uri file:///$(pwd)/wikipedia --input-path wiki-articles-10000.json

文档看起来是这样:

$ head -1 wiki-articles-10000.json
{"url":"https://en.wikipedia.org/wiki?curid=48687903","title":"Jeon Hye-jin (actress, born 1988)","body":"\nJeon Hye-jin (actress, born 1988)\n\nJeon Hye-jin (born June 17, 1988) is a South Korean actress.\nPersonal life.\nJeon married his \"Smile, You\" co-star Lee Chun-hee on March 11, 2011. Their daughter, Lee So Yu, was born on July 30, 2011.\n\n"}

第四步:启动 Server:

$ ./quickwit serve --index-uri file:///$(pwd)/wikipedia

然后就可以进行 Query 了:

$ curl "http://0.0.0.0:8080/api/v1/wikipedia/search?query=barack+AND+obama"
# 指定 field
$ curl "http://0.0.0.0:8080/api/v1/wikipedia/search?query=body:barack+AND+obama"

文件目录如下:

$ tree . -L 2
.
├── quickwit
├── wiki-articles-10000.json
├── wiki_index_config.json
└── wikipedia
├── 7fc17075-3a78-4071-be53-e7941023c94a
└── quickwit.json

噢,差点忘了,它还同时提供 gRPC 接口,默认 8082 端口;)

文档:Search more with less | Search more with less

GitHub 地址:quickwit-inc/quickwit: Quickwit is a highly cost-efficient search engine in Rust.

最后,顺带再安利一下另一个酷炫的搜索引擎:meilisearch/MeiliSearch: Powerful, fast, and an easy to use search engine。

libreddit:用 Rust 编写的 Reddit 私有前端

一旦 ​​cargo install libreddit​​ 后,只需:

$ libreddit

Reddit 就启动了。

主页:Libreddit

GitHub 地址:spikecodes/libreddit: Private front-end for Reddit written in Rust

quiche:QUIC 和 HTTP/3 的实现

QUIC: QUIC - Wikipedia

GitHub 地址:cloudflare/quiche:

网友评论