Awesome
Riot search
<img align="right" src="logo/512px.svg" width="15%"/> <!--<img align="right" src="https://raw.githubusercontent.com/go-ego/ego/master/logo.jpg">--> <!--<a href="https://circleci.com/gh/go-ego/ego/tree/dev"><img src="https://img.shields.io/circleci/project/go-ego/ego/dev.svg" alt="Build Status"></a>--> <!-- [![Release](https://github-release-version.herokuapp.com/github/go-ego/riot/release.svg?style=flat)](https://github.com/go-ego/riot/releases/latest) --> <!--<a href="https://github.com/go-ego/ego/releases"><img src="https://img.shields.io/badge/%20version%20-%206.0.0%20-blue.svg?style=flat-square" alt="Releases"></a>--> <!-- ![ego Logo](logo/512px.svg) -->Go Open Source, Distributed, Simple and efficient full text search engine.
Features
-
Efficient indexing and search (1M blog 500M data 28 seconds index finished, 1.65 ms search response time, 19K search QPS)
-
Support for logical search
-
Support Chinese word segmentation (use gse word segmentation package concurrent word, speed 27MB / s)
-
Support the calculation of the keyword in the text close to the distance(token proximity)
-
Support calculation BM25 correlation
-
Support add online, delete index
-
Support heartbeat
-
Support multiple persistent storage
-
Support distributed index and search
-
Can be achieved distributed index and search
Requirements
Go version >= 1.8
Dependencies
Riot uses go module or dep to manage dependencies.
Installation/Update
go get -u github.com/go-ego/riot
Build-tools
go get -u github.com/go-ego/re
re riot
To create a new riot application
$ re riot my-riotapp
re run
To run the application we just created, you can navigate to the application folder and execute:
$ cd my-riotapp && re run
Usage:
Look at an example
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!
Use default engine:
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)
}
Look at more Examples
Look at Store example
Look at Logic search example
Look at Pinyin search example
Look at different dict and language search example
Look at benchmark example
Riot search engine templates, client and dictionaries
Authors
License
Riot is primarily distributed under the terms of the Apache License (Version 2.0), base on wukong.