go-common/vendor/github.com/go-ego/riot
2019-04-22 18:49:16 +08:00
..
core Create & Init Project... 2019-04-22 18:49:16 +08:00
store Create & Init Project... 2019-04-22 18:49:16 +08:00
types Create & Init Project... 2019-04-22 18:49:16 +08:00
utils Create & Init Project... 2019-04-22 18:49:16 +08:00
appveyor.yml Create & Init Project... 2019-04-22 18:49:16 +08:00
BUILD.bazel Create & Init Project... 2019-04-22 18:49:16 +08:00
circle.yml Create & Init Project... 2019-04-22 18:49:16 +08:00
CONTRIBUTING.md Create & Init Project... 2019-04-22 18:49:16 +08:00
counters.go Create & Init Project... 2019-04-22 18:49:16 +08:00
engine.go Create & Init Project... 2019-04-22 18:49:16 +08:00
Gopkg.lock Create & Init Project... 2019-04-22 18:49:16 +08:00
Gopkg.toml Create & Init Project... 2019-04-22 18:49:16 +08:00
indexer_worker.go Create & Init Project... 2019-04-22 18:49:16 +08:00
info.go Create & Init Project... 2019-04-22 18:49:16 +08:00
LICENSE Create & Init Project... 2019-04-22 18:49:16 +08:00
ranker_worker.go Create & Init Project... 2019-04-22 18:49:16 +08:00
README_zh.md Create & Init Project... 2019-04-22 18:49:16 +08:00
README.md Create & Init Project... 2019-04-22 18:49:16 +08:00
riot_pkg.go Create & Init Project... 2019-04-22 18:49:16 +08:00
riot.go Create & Init Project... 2019-04-22 18:49:16 +08:00
segment.go Create & Init Project... 2019-04-22 18:49:16 +08:00
stop_tokens.go Create & Init Project... 2019-04-22 18:49:16 +08:00
store_worker.go Create & Init Project... 2019-04-22 18:49:16 +08:00

Riot search

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

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

简体中文

Features

Riot v0.10.0 was released in Nov 2017, check the Changelog for the full details.

Requirements

Go version >= 1.8

Vendored Dependencies

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.

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

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.