Open zc2638 opened 3 years ago
You MUST delete the content above including this line before posting, otherwise your issue will be invalid.
searcher := riot.Engine{} searcher.Init(types.EngineOpts{ Using: 3, //GseDict: "testdata/dictionary.txt", IndexerOpts: &types.IndexerOpts{ IndexType: types.DocIdsIndex, }, }) defer searcher.Close() text := "《复仇者联盟3:无限战争》a123是全片使用IMAX摄影机拍摄" text1 := "复仇:者在IMAX影院放222映时" text2 := "全片以上下扩展至IMAX 1.9:1的宽高比来呈现" text3 := "Google Is Experimenting With Virtual Reality Advertising" text4 := `Google accidentally pushed Bluetooth update for Home speaker early` text5 := `Google is testing another Search results layout with rounded cards, new colors, and the 4 mysterious colored dots again` //for i := 6; i < 10000; i++ { // in := strconv.Itoa(i) // content := fmt.Sprintf(format, i) // searcher.Index(in, types.DocData{ // Content: content, // }) //} // 将文档加入索引,docId 从0开始 searcher.Index("0", types.DocData{Content: text}) searcher.Index("1", types.DocData{Content: text1}) searcher.Index("2", types.DocData{Content: text2}) searcher.Index("3", types.DocData{Content: text3}) searcher.Index("4", types.DocData{Content: text4}) searcher.Index("5", types.DocData{Content: text5}) // 等待索引刷新完毕 searcher.Flush() // 搜索输出格式见 types.SearchResp 结构体 result := searcher.Search(types.SearchReq{ Text: "123", }) log.Print(result.NumDocs) log.Print(result)
2021/01/08 14:36:33 Dictionary file path is empty, load the default dictionary file. 2021/01/08 14:36:33 Dict files path: [/Users/zc/go/pkg/mod/github.com/go-ego/gse@v0.64.1/data/dict/dictionary.txt] 2021/01/08 14:36:33 Load the gse dictionary: "/Users/zc/go/pkg/mod/github.com/go-ego/gse@v0.64.1/data/dict/dictionary.txt" 2021/01/08 14:36:35 Gse dictionary loaded finished. 2021/01/08 14:36:35 Check virtualMemory... 2021/01/08 14:36:35 Total: 17179869184, Free: 4401246208, UsedPercent: 51.322794% 2021/01/08 14:36:35 0 2021/01/08 14:36:35 {{[123] false 0} []}
## Description ...
@vcaesar
You MUST delete the content above including this line before posting, otherwise your issue will be invalid.