Lucene is a Java-based search engine and one of the most popular open source search engines. Today we share a different, Golang-based search result: Riot.

Project address: github.com/go-ego/riot

Features

  • Efficient indexing and searching (1M tweets 500M data indexed in 28 seconds, 1.65ms search response time, 19K search QPS)
  • Support Chinese word segmentation (simultaneous word segmentation using GSE word segmentation package, speed 27MB/SEC)
  • Support for logical search
  • Support Chinese to Pinyin search (using Gpy Chinese to Pinyin search)
  • Support calculation of keyword token proximity in text
  • BM25 correlation can be calculated
  • Supports user-defined scoring fields and scoring rules
  • Supports adding and deleting indexes online
  • Support for multiple persistent storage
  • Support the heartbeat
  • Support for distributed indexing and searching
  • Distributed indexing and searching can be implemented
  • This document uses business-friendly Apache License V2
  • Check the segmentation rules

QQ group: 120563750

Install/Update

go get -u github.com/go-ego/riot

Requirements

Go version at least 1.8 is required

Dependencies

Riot uses the Go Module or DEP to manage dependencies.

Build-tools

go get -u github.com/go-ego/re

re riot

Creating a Riot project

$ re riot my-riotapp

re run

To run the Riot project we created, you can navigate to the applications folder and execute:

$ cd my-riotapp && re run

use

Let’s start with an example (from simplest_example.go)

Package main import ("log" "github.com/go-ego/riot" "github.com/go-ego/riot/types") VAR (// searcher is a coroutine safe searcher = riot.engine {}) func main() {// initialize searcher.init (types.engineopts {Using: 3, GseDict: "zh", // GseDict: "Your gopath" + "/ src/github.com/go-ego/riot/data/dict/dictionary.txt,"}) defer a searcher. Close () the text: = "the avengers alliance 3: Text1 := "when shown in IMAX theaters" Text2 := "The entire film is extended to IMAX 1.9: // Add documents to Index, docId starts at 1 searcher.index ("1", types.docdata {Content: text}) searcher.Index("2", types.DocData{Content: text1}, false) searcher.Index("3", types.DocData{Content: text2}, FlushIndex() // engine.FlushIndex() // The search output is formatted in the types.SearchResp structure Log.print (searcher.Search(types.SearchReq{Text:" Avengers "}))}Copy the code

Isn’t it easy?

Then check out a how-to tutorial that will teach you how to implement a twitter search site with less than 200 lines of Go code.

Use the 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: "No reason "} searcher.index ("1", data) searcher.index ("2", data1) searcher.indexDoc ("3", Data2) searcher.flush () req := types.searchreq {Text: "hello "} search := searcher.search (req) log.println ("search...") , search) }Copy the code

See more examples

An example of persistence

Example of logical search

Examples of pinyin search

Different dictionaries and language examples

benchmark

Riot searches templates, clients, and dictionaries

Major improvements:

  • Add logical search
  • Added pinyin search
  • Increasing distribution
  • Segmentation and other improvements
  • Add more apis
  • Support the heartbeat
  • Fix the bug
  • Remove storage engines that depend on CGO and add Badger and LevelDB persistence engines

Authors

  • The author is vz
  • Maintainers
  • Contributors

Donate

Support riot, Buy me a coffee.

Paypal

Donate money by paypal to my account [email protected]

other

  • Why riot engine
  • contact

License

Riot is primarily distributed under the terms of the Apache License (Version 2.0), base on wukong.

Lucene is a Java-based search engine and one of the most popular open source search engines. Today we share a different, Golang-based search result: Riot.

Project address: github.com/go-ego/riot

Features

  • Efficient indexing and searching (1M tweets 500M data indexed in 28 seconds, 1.65ms search response time, 19K search QPS)
  • Support Chinese word segmentation (simultaneous word segmentation using GSE word segmentation package, speed 27MB/SEC)
  • Support for logical search
  • Support Chinese to Pinyin search (using Gpy Chinese to Pinyin search)
  • Support calculation of keyword token proximity in text
  • BM25 correlation can be calculated
  • Supports user-defined scoring fields and scoring rules
  • Supports adding and deleting indexes online
  • Support for multiple persistent storage
  • Support the heartbeat
  • Support for distributed indexing and searching
  • Distributed indexing and searching can be implemented
  • This document uses business-friendly Apache License V2
  • Check the segmentation rules

QQ group: 120563750

Install/Update

go get -u github.com/go-ego/riot

Requirements

Go version at least 1.8 is required

Dependencies

Riot uses the Go Module or DEP to manage dependencies.

Build-tools

go get -u github.com/go-ego/re

re riot

Creating a Riot project

$ re riot my-riotapp

re run

To run the Riot project we created, you can navigate to the applications folder and execute:

$ cd my-riotapp && re run

use

Let’s start with an example (from simplest_example.go)

Package main import ("log" "github.com/go-ego/riot" "github.com/go-ego/riot/types") VAR (// searcher is a coroutine safe searcher = riot.engine {}) func main() {// initialize searcher.init (types.engineopts {Using: 3, GseDict: "zh", // GseDict: "Your gopath" + "/ src/github.com/go-ego/riot/data/dict/dictionary.txt,"}) defer a searcher. Close () the text: = "the avengers alliance 3: Text1 := "when shown in IMAX theaters" Text2 := "The entire film is extended to IMAX 1.9: // Add documents to Index, docId starts at 1 searcher.index ("1", types.docdata {Content: text}) searcher.Index("2", types.DocData{Content: text1}, false) searcher.Index("3", types.DocData{Content: text2}, FlushIndex() // engine.FlushIndex() // The search output is formatted in the types.SearchResp structure Log.print (searcher.Search(types.SearchReq{Text:" Avengers "}))}Copy the code

Isn’t it easy?

Then check out a how-to tutorial that will teach you how to implement a twitter search site with less than 200 lines of Go code.

Use the 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: "No reason "} searcher.index ("1", data) searcher.index ("2", data1) searcher.indexDoc ("3", Data2) searcher.flush () req := types.searchreq {Text: "hello "} search := searcher.search (req) log.println ("search...") , search) }Copy the code

See more examples

An example of persistence

Example of logical search

Examples of pinyin search

Different dictionaries and language examples

benchmark

Riot searches templates, clients, and dictionaries

Major improvements:

  • Add logical search
  • Added pinyin search
  • Increasing distribution
  • Segmentation and other improvements
  • Add more apis
  • Support the heartbeat
  • Fix the bug
  • Remove storage engines that depend on CGO and add Badger and LevelDB persistence engines

Authors

  • The author is vz
  • Maintainers
  • Contributors

Donate

Support riot, Buy me a coffee.

Paypal

Donate money by paypal to my account [email protected]

other

  • Why riot engine
  • contact

License

Riot is primarily distributed under the terms of the Apache License (Version 2.0), base on wukong.