- 高效索引和搜索(1M条微博500M数据28秒索引完,1.65毫秒搜索响应时间,19K搜索QPS)
- 支持中文分词(使用gse分词包并发分词,速度27MB/秒)
- 支持逻辑搜索
- 支持中文转拼音搜索
- 支持计算关键词在文本中的紧邻距离(token proximity)
- 支持计算BM25相关度
- 支持自定义评分字段和评分规则
- 支持在线添加、删除索引
- 支持多种持久存储
- 支持 heartbeat
- 支持分布式索引和搜索
- 可实现分布式索引和搜索
- 采用对商业应用友好的Apache License v2发布
QQ 群: 120563750
go get -u github.com/go-ego/riot
需要 Go 版本至少 1.8
go get -u github.com/go-ego/re
创建 riot 项目
$ re riot my-riotapp
运行我们创建的 riot 项目, 你可以导航到应用程序文件夹并执行:
$ cd my-riotapp && re run
先看一个例子(来自simplest_example.go)
package main
import (
"log"
"github.com/go-ego/riot/engine"
"github.com/go-ego/riot/types"
)
var (
// searcher是协程安全的
searcher = engine.Engine{}
)
func main() {
// 初始化
searcher.Init(types.EngineInitOptions{
Using: 4,
SegmenterDict: "github.com/go-ego/riot/data/dict/dictionary.txt"})
defer searcher.Close()
// 将文档加入索引,docId 从1开始
searcher.IndexDocument(1, types.DocIndexData{Content: "此次百度收购将成中国互联网最大并购"}, false)
searcher.IndexDocument(2, types.DocIndexData{Content: "百度宣布拟全资收购91无线业务"}, false)
searcher.IndexDocument(3, types.DocIndexData{Content: "百度是中国最大的搜索引擎"}, false)
// 等待索引刷新完毕
searcher.FlushIndex()
// 搜索输出格式见types.SearchResponse结构体
log.Print(searcher.Search(types.SearchRequest{Text:"百度中国"}))
}
是不是很简单!
然后看看一个入门教程,教你用不到200行Go代码实现一个微博搜索网站。
- 增加逻辑搜索
- 增加拼音搜索
- 增加分布式
- 分词等改进
- 增加更多 api
- 支持 heartbeat
- 修复 bug
- 删除依赖 cgo 的存储引擎, 增加 badger和 leveldb 持久化引擎
支持 riot, buy me a coffee.
Donate money by paypal to my account [email protected]
Riot is primarily distributed under the terms of the Apache License (Version 2.0), base on wukong.