riot 分布式全文搜索引擎, 采用 Go 语言开发。功能特性:
示例代码:
package main
import (
"log"
"github.com/go-ego/riot/engine"
"github.com/go-ego/riot/types"
)
var (
// searcher is coroutine safe
searcher = engine.Engine{}
)
func main() {
// Init searcher
searcher.Init(types.EngineInitOptions{
Using: 5,
SegmenterDict: "./dict/dictionary.txt"})
defer searcher.Close()
// Add the document to the index, docId starts at 1
searcher.IndexDocument(1, types.DocIndexData{Content: "Google Is Experimenting With Virtual Reality Advertising"}, false)
searcher.IndexDocument(2, types.DocIndexData{Content: "Google accidentally pushed Bluetooth update for Home speaker early"}, false)
searcher.IndexDocument(3, types.DocIndexData{Content: "Google is testing another Search results layout with rounded cards, new colors, and the 4 mysterious colored dots again"}, false)
// Wait for the index to refresh
searcher.FlushIndex()
// The search output format is found in the types.SearchResponse structure
log.Print(searcher.Search(types.SearchRequest{Text: "google testing"}))
}
主要改进:
项目详情:
Github 在线源码: https://github.com/go-ego/riot
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.