diff --git a/README.md b/README.md index 5056c23..cd499c5 100644 --- a/README.md +++ b/README.md @@ -63,13 +63,13 @@ package main import ( "log" - "github.com/go-ego/riot/engine" + "github.com/go-ego/riot" "github.com/go-ego/riot/types" ) var ( // searcher is coroutine safe - searcher = engine.Engine{} + searcher = riot.Engine{} ) func main() { diff --git a/README_zh.md b/README_zh.md index 7339b34..19d7ae4 100755 --- a/README_zh.md +++ b/README_zh.md @@ -64,13 +64,13 @@ package main import ( "log" - "github.com/go-ego/riot/engine" + "github.com/go-ego/riot" "github.com/go-ego/riot/types" ) var ( // searcher 是协程安全的 - searcher = engine.Engine{} + searcher = riot.Engine{} ) func main() { diff --git a/data/riot/main.go b/data/riot/main.go index 0b43efe..50c35f5 100644 --- a/data/riot/main.go +++ b/data/riot/main.go @@ -23,14 +23,14 @@ import ( rpc "github.com/go-ego/riot/net/grpc" rhttp "github.com/go-ego/riot/net/http" - "github.com/go-ego/riot/engine" + "github.com/go-ego/riot" "github.com/go-vgo/gt/conf" "github.com/go-vgo/gt/zlog" ) var ( // searcher is coroutine safe - searcher = engine.Engine{} + searcher = riot.Engine{} ) // var config rpc.Config diff --git a/data/riot1/main.go b/data/riot1/main.go index 480778e..dede495 100644 --- a/data/riot1/main.go +++ b/data/riot1/main.go @@ -22,14 +22,14 @@ import ( rpc "github.com/go-ego/riot/net/grpc" rhttp "github.com/go-ego/riot/net/http" - "github.com/go-ego/riot/engine" + "github.com/go-ego/riot" "github.com/go-vgo/gt/conf" "github.com/go-vgo/gt/zlog" ) var ( // searcher is coroutine safe - searcher = engine.Engine{} + searcher = riot.Engine{} ) var config com.Config diff --git a/docs/zh/codelab.md b/docs/zh/codelab.md index c719901..e6f9308 100755 --- a/docs/zh/codelab.md +++ b/docs/zh/codelab.md @@ -56,14 +56,14 @@ type Weibo struct { ```go import ( - "github.com/go-ego/riot/engine" + "github.com/go-ego/riot" "github.com/go-ego/riot/types" ) ``` 第一个包定义了引擎功能,第二个包定义了常用结构体。在使用引擎之前需要初始化,例如 ```go -var searcher engine.Engine +var searcher riot.Engine searcher.Init(types.EngineInitOptions{ SegmenterDict: "../../data/dict/dictionary.txt", StopTokenFile: "../../data/dict/stop_tokens.txt", @@ -184,11 +184,12 @@ response := searcher.Search(types.SearchRequest{ 如果你想进一步了解riot 引擎,建议你直接阅读代码。代码的目录结构如下: - /core 核心部件,包括索引器和排序器 - /data 字典文件和停用词文件 - /docs 文档 - /engine 引擎,包括主协程、分词协程、索引器协程和排序器协程的实现 - /examples 例子和性能测试程序 - /testdata 测试数据 - /types 常用结构体 - /utils 常用函数 + riot/ 引擎,包括主协程、分词协程、索引器协程和排序器协程的实现 + /core 核心部件,包括索引器和排序器 + /data 字典文件和停用词文件 + /docs 文档 + /engine 引擎,包括主协程、分词协程、索引器协程和排序器协程的实现, 已移到主目录 + /examples 例子和性能测试程序 + /testdata 测试数据 + /types 常用结构体 + /utils 常用函数 diff --git a/docs/zh/custom_scoring_criteria.md b/docs/zh/custom_scoring_criteria.md index c2cbffe..c264d30 100755 --- a/docs/zh/custom_scoring_criteria.md +++ b/docs/zh/custom_scoring_criteria.md @@ -29,7 +29,7 @@ func (criteria MyScoringCriteria) Score( } ``` -文档的MyScoringFields数据通过engine.Engine的IndexDocument函数传给排序器保存在内存中。然后通过Search函数的参数调用MyScoringCriteria进行查询。 +文档的MyScoringFields数据通过 riot.Engine 的 IndexDocument 函数传给排序器保存在内存中。然后通过Search函数的参数调用 MyScoringCriteria 进行查询。 当然,MyScoringCriteria的Score函数也可以通过docId从硬盘或数据库读取更多文档数据用于打分,但速度要比从内存中直接读慢许多,请在内存和速度之间合适取舍。 diff --git a/examples/benchmark/benchmark.go b/examples/benchmark/benchmark.go index 509a01a..4bc964e 100755 --- a/examples/benchmark/benchmark.go +++ b/examples/benchmark/benchmark.go @@ -13,7 +13,7 @@ import ( "sync" "time" - "github.com/go-ego/riot/engine" + "github.com/go-ego/riot" "github.com/go-ego/riot/types" ) @@ -49,7 +49,7 @@ var ( storageEngine = flag.String("storageEngine", "lbd", "use StorageEngine") persistentStorageShards = flag.Int("persistentStorageShards", 0, "持久数据库存储裂分数目") - searcher = engine.Engine{} + searcher = riot.Engine{} options = types.RankOptions{ OutputOffset: 0, MaxOutputs: 100, @@ -202,7 +202,7 @@ func main() { if *usePersistent { searcher.Close() t6 := time.Now() - searcher1 := engine.Engine{} + searcher1 := riot.Engine{} searcher1.Init(types.EngineInitOptions{ SegmenterDict: *dictionaries, StopTokenFile: *stopTokenFile, diff --git a/examples/codelab/search_server.go b/examples/codelab/search_server.go index b8e6ce4..7f4d60c 100755 --- a/examples/codelab/search_server.go +++ b/examples/codelab/search_server.go @@ -15,7 +15,7 @@ import ( "strconv" "strings" - "github.com/go-ego/riot/engine" + "github.com/go-ego/riot" "github.com/go-ego/riot/types" ) @@ -27,7 +27,7 @@ const ( ) var ( - searcher = engine.Engine{} + searcher = riot.Engine{} wbs = map[uint64]Weibo{} weiboData = flag.String("weibo_data", "../../testdata/weibo_data.txt", "微博数据文件") dictFile = flag.String("dict_file", "../../data/dict/dictionary.txt", "词典文件") diff --git a/examples/logic/main.go b/examples/logic/main.go index 6c264ea..2ada9e6 100644 --- a/examples/logic/main.go +++ b/examples/logic/main.go @@ -17,13 +17,13 @@ package main import ( "log" - "github.com/go-ego/riot/engine" + "github.com/go-ego/riot" "github.com/go-ego/riot/types" ) var ( // searcher is coroutine safe - searcher = engine.Engine{} + searcher = riot.Engine{} ) func main() { diff --git a/examples/pinyin/main.go b/examples/pinyin/main.go index 1439378..fffde2c 100644 --- a/examples/pinyin/main.go +++ b/examples/pinyin/main.go @@ -18,13 +18,13 @@ import ( "fmt" "os" - "github.com/go-ego/riot/engine" + "github.com/go-ego/riot" "github.com/go-ego/riot/types" ) var ( // searcher是协程安全的 - searcher = engine.Engine{} + searcher = riot.Engine{} ) func initEngine() { diff --git a/examples/pinyin_weibo/main.go b/examples/pinyin_weibo/main.go index 0b15bfb..0de5dae 100644 --- a/examples/pinyin_weibo/main.go +++ b/examples/pinyin_weibo/main.go @@ -12,7 +12,7 @@ import ( "os" "os/signal" - "github.com/go-ego/riot/engine" + "github.com/go-ego/riot" "github.com/go-ego/riot/types" ) @@ -24,7 +24,7 @@ const ( ) var ( - searcher = engine.Engine{} + searcher = riot.Engine{} wbs = map[uint64]Weibo{} weiboData = flag.String("weibo_data", "weibo.txt", "微博数据文件") dictFile = flag.String("dict_file", "../../data/dict/dictionary.txt", "词典文件") diff --git a/examples/simple/main.go b/examples/simple/main.go index 1a8079e..feff906 100644 --- a/examples/simple/main.go +++ b/examples/simple/main.go @@ -17,13 +17,13 @@ package main import ( "log" - "github.com/go-ego/riot/engine" + "github.com/go-ego/riot" "github.com/go-ego/riot/types" ) var ( // searcher is coroutine safe - searcher = engine.Engine{} + searcher = riot.Engine{} ) func main() { diff --git a/examples/simple/zh/main.go b/examples/simple/zh/main.go index c10c187..88d66c5 100755 --- a/examples/simple/zh/main.go +++ b/examples/simple/zh/main.go @@ -9,13 +9,13 @@ package main import ( "log" - "github.com/go-ego/riot/engine" + "github.com/go-ego/riot" "github.com/go-ego/riot/types" ) var ( // searcher 是线程安全的 - searcher = engine.Engine{} + searcher = riot.Engine{} ) func main() { diff --git a/examples/store/main.go b/examples/store/main.go index 83946bf..9e01b00 100644 --- a/examples/store/main.go +++ b/examples/store/main.go @@ -19,13 +19,13 @@ import ( "log" "os" - "github.com/go-ego/riot/engine" + "github.com/go-ego/riot" "github.com/go-ego/riot/types" ) var ( // searcher is coroutine safe - searcher = engine.Engine{} + searcher = riot.Engine{} ) func initEngine() { diff --git a/examples/weibo/custom_scoring_criteria.go b/examples/weibo/custom_scoring_criteria.go index e995165..1c74a26 100755 --- a/examples/weibo/custom_scoring_criteria.go +++ b/examples/weibo/custom_scoring_criteria.go @@ -23,7 +23,7 @@ import ( "strconv" "strings" - "github.com/go-ego/riot/engine" + "github.com/go-ego/riot" "github.com/go-ego/riot/types" ) @@ -52,7 +52,7 @@ var ( "../../data/dict/stop_tokens.txt", "停用词文件") - searcher = engine.Engine{} + searcher = riot.Engine{} options = types.RankOptions{ ScoringCriteria: WeiboScoringCriteria{}, OutputOffset: 0, diff --git a/net/com/search.go b/net/com/search.go index abdd69b..191c881 100644 --- a/net/com/search.go +++ b/net/com/search.go @@ -18,14 +18,14 @@ import ( "log" "os" - "github.com/go-ego/riot/engine" + "github.com/go-ego/riot" "github.com/go-ego/riot/types" // "github.com/go-vgo/gt/zlog" ) var ( // Searcher is coroutine safe - Searcher = engine.Engine{} + Searcher = riot.Engine{} // Conf is config Conf Config )