- Notifications
You must be signed in to change notification settings - Fork476
Go Open Source, Distributed, Simple and efficient Search Engine; Warning: This is V1 and beta version, because of big memory consume, and the V2 will be rewrite all code.
License
go-ego/riot
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Go Open Source, Distributed, Simple and efficient full text search engine.
Efficient indexing and search (1M blog 500M data 28 seconds index finished, 1.65 ms search response time, 19K search QPS)
Support forlogical search
Support Chinese word segmentation (usegse word segmentation package concurrent word, speed 27MB / s)
Support the calculation of the keyword in the textclose to the distance(token proximity)
Support calculationBM25 correlation
Supportadd online, delete index
Support heartbeat
Support multiplepersistent storage
Supportdistributed index and search
Can be achieveddistributed index and search
Go version >= 1.8
Riot uses go module or dep to manage 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 mainimport ("log""github.com/go-ego/riot""github.com/go-ego/riot/types")var (// searcher is coroutine safesearcher= riot.Engine{})funcmain() {// Initsearcher.Init(types.EngineOpts{// Using: 4,NotUseGse:true,})defersearcher.Close()text:="Google Is Experimenting With Virtual Reality Advertising"text1:=`Google accidentally pushed Bluetooth update for Homespeaker early`text2:=`Google is testing another Search results layout withrounded cards, new colors, and the 4 mysterious colored dots again`// Add the document to the index, docId starts at 1searcher.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 refreshsearcher.Flush()// engine.FlushIndex()// The search output format is found in the types.SearchResp structurelog.Print(searcher.Search(types.SearchReq{Text:"google testing"}))}
It is very simple!
package mainimport ("log""github.com/go-ego/riot""github.com/go-ego/riot/types")var (searcher=riot.New("zh"))funcmain() {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)}
Riot is primarily distributed under the terms of the Apache License (Version 2.0), base onwukong.
About
Go Open Source, Distributed, Simple and efficient Search Engine; Warning: This is V1 and beta version, because of big memory consume, and the V2 will be rewrite all code.