tangs b030ce89ca openbilibili | 5 éve | |
---|---|---|
.. | ||
core | 5 éve | |
store | 5 éve | |
types | 5 éve | |
utils | 5 éve | |
BUILD.bazel | 5 éve | |
CONTRIBUTING.md | 5 éve | |
Gopkg.lock | 5 éve | |
Gopkg.toml | 5 éve | |
LICENSE | 5 éve | |
README.md | 5 éve | |
README_zh.md | 5 éve | |
appveyor.yml | 5 éve | |
circle.yml | 5 éve | |
counters.go | 5 éve | |
engine.go | 5 éve | |
indexer_worker.go | 5 éve | |
info.go | 5 éve | |
ranker_worker.go | 5 éve | |
riot.go | 5 éve | |
riot_pkg.go | 5 éve | |
segment.go | 5 éve | |
stop_tokens.go | 5 éve | |
store_worker.go | 5 éve |
Go Open Source, Distributed, Simple and efficient full text search engine.
Can be achieved distributed index and search
Riot v0.10.0 was released in Nov 2017, check the Changelog for the full details.
Go version >= 1.8
Riot uses dep to vendor dependencies, but we don't commit the vendored packages themselves to the Riot git repository. Therefore, a simple go get is not supported because the command is not vendor aware.
Please manage it with dep, run dep ensure
, to clone dependencies.
go get -u github.com/go-ego/riot
go get -u github.com/go-ego/re
To create a new riot application
$ re riot my-riotapp
To run the application we just created, you can navigate to the application folder and execute:
$ cd my-riotapp && re run
package main
import (
"log"
"github.com/go-ego/riot"
"github.com/go-ego/riot/types"
)
var (
// searcher is coroutine safe
searcher = riot.Engine{}
)
func main() {
// Init
searcher.Init(types.EngineOpts{
// Using: 4,
NotUseGse: true,
})
defer searcher.Close()
text := "Google Is Experimenting With Virtual Reality Advertising"
text1 := `Google accidentally pushed Bluetooth update for Home
speaker early`
text2 := `Google is testing another Search results layout with
rounded cards, new colors, and the 4 mysterious colored dots again`
// Add the document to the index, docId starts at 1
searcher.Index(1, types.DocData{Content: text})
searcher.Index(2, types.DocData{Content: text1}, false)
searcher.IndexDoc(3, types.DocData{Content: text2}, true)
// Wait for the index to refresh
searcher.Flush()
// engine.FlushIndex()
// The search output format is found in the types.SearchResp structure
log.Print(searcher.Search(types.SearchReq{Text:"google testing"}))
}
It is very simple!
package main
import (
"log"
"github.com/go-ego/riot"
"github.com/go-ego/riot/types"
)
var (
searcher = riot.New("zh")
)
func main() {
data := types.DocData{Content: `I wonder how, I wonder why
, I wonder where they are`}
data1 := types.DocData{Content: "所以, 你好, 再见"}
data2 := types.DocData{Content: "没有理由"}
searcher.Index(1, data)
searcher.Index(2, data1)
searcher.Index(3, data2)
searcher.Flush()
req := types.SearchReq{Text: "你好"}
search := searcher.Search(req)
log.Println("search...", search)
}
Supporting riot, buy me a coffee.
Donate money by paypal to my account vzvway@gmail.com
Riot is primarily distributed under the terms of the Apache License (Version 2.0), base on wukong.