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

Hui Chen a285746475 Merge pull request #50 from merryChris/master 9 vuotta sitten
core 2cf3d2f095 1. 修改 benchmark, 打乱 docId 顺序模拟普通情况测试 9 vuotta sitten
data 77121830e9 第一发 12 vuotta sitten
docs 2cf3d2f095 1. 修改 benchmark, 打乱 docId 顺序模拟普通情况测试 9 vuotta sitten
engine 2cf3d2f095 1. 修改 benchmark, 打乱 docId 顺序模拟普通情况测试 9 vuotta sitten
examples 2cf3d2f095 1. 修改 benchmark, 打乱 docId 顺序模拟普通情况测试 9 vuotta sitten
storage af2c876a7d 修正持久存储中的几个bug 10 vuotta sitten
testdata 06da509aa0 Delete weibo_data.txt 11 vuotta sitten
types 6841ff5b85 实现了对索引的批量加入和删除操作,并添加单测 10 vuotta sitten
utils 1325da904c refactor storage 代码 10 vuotta sitten
.gitignore 6841ff5b85 实现了对索引的批量加入和删除操作,并添加单测 10 vuotta sitten
README.md 2cf3d2f095 1. 修改 benchmark, 打乱 docId 顺序模拟普通情况测试 9 vuotta sitten
license.txt 77121830e9 第一发 12 vuotta sitten
wukong.go af2c876a7d 修正持久存储中的几个bug 10 vuotta sitten

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(1, types.DocumentIndexData{Content: "此次百度收购将成中国互联网最大并购"}, true)
	searcher.IndexDocument(2, types.DocumentIndexData{Content: "百度宣布拟全资收购91无线业务"}, true)
	searcher.IndexDocument(3, types.DocumentIndexData{Content: "百度是中国最大的搜索引擎"}, true)

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

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

是不是很简单!

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

其它