We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
引擎初始化开启NotUsingSegmenter,运行程序会出现panic,比如用以下例子:
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: "../../data/dictionary.txt", NotUsingSegmenter: true, }) defer searcher.Close()
// 将文档加入索引,docId 从1开始 searcher.IndexDocument(1, types.DocumentIndexData{Content: "此次百度收购将成中国互联网最大并购"}, false) searcher.IndexDocument(2, types.DocumentIndexData{Content: "百度宣布拟全资收购91无线业务"}, false) searcher.IndexDocument(3, types.DocumentIndexData{Content: "百度是中国最大的搜索引擎"}, false) // 等待索引刷新完毕 searcher.FlushIndex() // 搜索输出格式见types.SearchResponse结构体 log.Print(searcher.Search(types.SearchRequest{Text: "中"}))
}
这个段程序无法执行。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
引擎初始化开启NotUsingSegmenter,运行程序会出现panic,比如用以下例子:
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: "../../data/dictionary.txt",
NotUsingSegmenter: true,
})
defer searcher.Close()
}
这个段程序无法执行。
The text was updated successfully, but these errors were encountered: