开源,分布式、简单高效的搜索引擎;警告:这是 V1 测试版,内存消耗较大,V2 将会重写
English | 简体中文 | 繁體中文 | 日本語 | 한국어 | Français | Deutsch | Español | Русский | Português
The fast modern text indexing in go, fork form the bluge
go get -u github.com/vcaesar/riotRunnable versions of all three programs live in test/readme_demo.
Save as write/main.go and run with go run ./write:
package main
import (
"log"
riot "github.com/vcaesar/riot"
)
func main() {
config := riot.DefaultConfig("./riot_index")
writer, err := riot.OpenWriter(config)
if err != nil {
log.Fatalf("error opening writer: %v", err)
}
defer writer.Close()
doc := riot.NewDocument("example").
AddField(riot.NewTextField("name", "riot"))
err = writer.Update(doc.ID(), doc)
if err != nil {
log.Fatalf("error updating document: %v", err)
}
log.Printf("indexed: %s", doc.ID())
}Save as read/main.go and run with go run ./read against the index written above.
If you index and search in the same process, use writer.Reader() instead of riot.OpenReader
(or riot.InMemoryOnlyConfig() for an in-memory index):
…Output:
match: exampleThe gse package wraps riot with a gse tokenizer for
CJK text, plus query-string search and highlighting. Save as gse/main.go and run with
go run ./gse:
…Output:
…Apache License Version 2.0
暂无开放 Issues,或尚未同步最近议题。