go 分布式全文搜索引擎 RiotSearch

2017-10-25 01:31:08 +08:00
 vway

riot 分布式全文搜索引擎, 采用 Go 语言开发。功能特性:

示例代码:

package main

import (
	"log"

	"github.com/go-ego/riot/engine"
	"github.com/go-ego/riot/types"
)

var (
	// searcher is coroutine safe
	searcher = engine.Engine{}
)

func main() {
	// Init searcher
	searcher.Init(types.EngineInitOptions{
		Using:             5,
		SegmenterDict: "./dict/dictionary.txt"})
	defer searcher.Close()

	// Add the document to the index, docId starts at 1
	searcher.IndexDocument(1, types.DocIndexData{Content: "Google Is Experimenting With Virtual Reality Advertising"}, false)
	searcher.IndexDocument(2, types.DocIndexData{Content: "Google accidentally pushed Bluetooth update for Home speaker early"}, false)
	searcher.IndexDocument(3, types.DocIndexData{Content: "Google is testing another Search results layout with rounded cards, new colors, and the 4 mysterious colored dots again"}, false)

	// Wait for the index to refresh
	searcher.FlushIndex()

	// The search output format is found in the types.SearchResponse structure
	log.Print(searcher.Search(types.SearchRequest{Text: "google testing"}))
}

主要改进:

项目详情:

Github 在线源码: https://github.com/go-ego/riot

6944 次点击
所在节点    程序员
27 条回复
vway
2017-10-25 13:46:11 +08:00
@NeinChn 感谢建议, 改进会列入考虑
whyw
2017-10-25 17:00:24 +08:00
支持, 很好
vway
2017-10-25 18:47:13 +08:00
@whyw 感谢支持
alexapollo
2017-10-25 19:53:13 +08:00
TFIDF / BM25 只能得到一个很差的结果,想工业化还比较远的……
NeinChn
2017-10-25 20:04:16 +08:00
@alexapollo
如果只是排序优劣,这个系统也支持 custom rank score
是不是合适工业化,不只需要看 TF-IDF/BM25
有其他更需要看重的 feature
alexapollo
2017-10-25 22:52:29 +08:00
@NeinChn 搜索引擎不是仅仅用相关性就可以解决的
vway
2017-10-25 23:59:48 +08:00
@alexapollo 看应用场景, 而且刚开源目前还在在完善中

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/400415

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX