wukongd is a search engine working as a standalone service, based on wukong

geili 1325da904c refactor storage 代码 hace 10 años
core 15a3af9204 添加紧密度计算单元测试(可致旧版本的错误下标出错) hace 12 años
data 77121830e9 第一发 hace 12 años
docs d76a7364f3 Update persistent_storage.md hace 10 años
engine 1325da904c refactor storage 代码 hace 10 años
examples ce760b0250 Update search_server.go hace 10 años
storage 1325da904c refactor storage 代码 hace 10 años
testdata 06da509aa0 Delete weibo_data.txt hace 11 años
types c876966fbf 修正持久存储写入shard不确定的错误 hace 12 años
utils 1325da904c refactor storage 代码 hace 10 años
README.md 11b0cb9ad5 Update README.md hace 10 años
license.txt 77121830e9 第一发 hace 12 años
wukong.go 123909225a 自动抓取依赖包 hace 12 años

README.md

悟空全文搜索引擎

微博搜索demo

安装/更新

go get -u -v github.com/huichen/wukong

需要Go版本至少1.1.1

使用

先看一个例子(来自examples/simplest_example.go

package main

import (
	"github.com/huichen/wukong/engine"
	"github.com/huichen/wukong/types"
	"log"
)

var (
	// searcher是协程安全的
	searcher = engine.Engine{}
)

func main() {
	// 初始化
	searcher.Init(types.EngineInitOptions{
		SegmenterDictionaries: "github.com/huichen/wukong/data/dictionary.txt"})
	defer searcher.Close()

	// 将文档加入索引
	searcher.IndexDocument(0, types.DocumentIndexData{Content: "此次百度收购将成中国互联网最大并购"})
	searcher.IndexDocument(1, types.DocumentIndexData{Content: "百度宣布拟全资收购91无线业务"})
	searcher.IndexDocument(2, types.DocumentIndexData{Content: "百度是中国最大的搜索引擎"})

	// 等待索引刷新完毕
	searcher.FlushIndex()

	// 搜索输出格式见types.SearchResponse结构体
	log.Print(searcher.Search(types.SearchRequest{Text:"百度中国"}))
}

是不是很简单!

然后看看一个入门教程,教你用不到200行Go代码实现一个微博搜索网站。

其它