Skip to content
Go Open Source, Distributed, Simple and efficient Search Engine
Go
Branch: master
Clone or download

Latest commit

vcaesar Merge pull request #99 from go-ego/dev-m
Update CI and Fixed go mod error
Latest commit bdbc256 Dec 16, 2019

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github update go.yml and circle.yml Dec 15, 2019
core gofmt and fix spelling error Dec 17, 2018
data update grpc and protobuf code Dec 4, 2018
docs Merge pull request #72 from go-ego/ids-pr Dec 17, 2018
engine Update code and vendor Nov 18, 2017
examples gofmt and fix spelling error Dec 17, 2018
geo add geo Oct 21, 2017
logo update logo and README.md more concise Jul 5, 2018
net add go-systemd to vendor, fixed go mod error Dec 15, 2019
store update bg store fixed api, update and tiny mod Jul 27, 2019
testdata recover and simplify test Sep 6, 2018
types add gse segment hmm option Jan 29, 2019
utils update test_utils and test Apr 3, 2018
vendor/github.com/coreos/go-systemd add go-systemd to vendor, fixed go mod error Dec 15, 2019
.gitignore Update engine test code and Travis Dec 15, 2019
.travis.yml Update engine test code and Travis Dec 15, 2019
CONTRIBUTING.md update and unify copyright year Feb 1, 2018
LICENSE Initial commit Jun 21, 2017
README.md Update README.md [ci skip] Nov 27, 2018
README_zh.md Update README.md Aug 2, 2019
appveyor.yml Update CI add go1.13.x support Dec 15, 2019
circle.yml update go.yml and circle.yml Dec 15, 2019
counters.go optimize counters func [ci skip] Aug 21, 2018
engine.go add gse segment hmm support and optimize gse searchmode code Jan 29, 2019
engine_test.go Update engine test code and Travis Dec 15, 2019
go.mod add go-systemd to vendor, fixed go mod error Dec 15, 2019
go.sum add go-systemd to vendor, fixed go mod error Dec 15, 2019
indexer_worker.go update indexer worker code [ci skip] Nov 19, 2018
info.go update new func and name, add with mode Jul 12, 2018
info_test.go add search doc and search id func and update test Aug 15, 2018
ranker_worker.go update ranker_worker and segment code docid type to string [ci skip] Nov 19, 2018
riot.go update riot.go code [ci skip] Nov 26, 2018
riot_pkg.go fix spell and golint error Sep 6, 2018
riot_test.go update test code [ci skip] Nov 26, 2018
segment.go update ranker_worker and segment code docid type to string [ci skip] Nov 19, 2018
stop_tokens.go update stopTokenFile log and pkg Jun 28, 2018
store_worker.go update store worker code [ci skip] Nov 19, 2018
test_utils.go update test utils code [ci skip] Nov 26, 2018

README.md

Riot search

CircleCI Status Appveyor codecov Build Status Go Report Card GoDoc GitHub release Join the chat at https://gitter.im/go-ego/ego

Go Open Source, Distributed, Simple and efficient full text search engine.

简体中文

Features

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

Donate

Supporting riot, buy me a coffee.

Paypal

Donate money by paypal to my account vzvway@gmail.com

License

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

You can’t perform that action at this time.