Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

Digital fuzzy query does not work #124

Open
3 tasks
zc2638 opened this issue Jan 8, 2021 · 1 comment
Open
3 tasks

Digital fuzzy query does not work #124

zc2638 opened this issue Jan 8, 2021 · 1 comment

Comments

@zc2638
Copy link

zc2638 commented Jan 8, 2021

  1. Please speak English, this is the language everybody of us can speak and write.
  2. Please take a moment to search that an issue doesn't already exist.
  3. Please ask questions or config/deploy problems on our Gitter channel: https://gitter.im/go-ego/ego
  4. Please give all relevant information below for bug reports, incomplete details will be handled as an invalid report.

You MUST delete the content above including this line before posting, otherwise your issue will be invalid.

  • Riot version (or commit ref): v0.0.0-20201013133145-f4c30acb3704
  • Go version: v1.15
  • Operating system and bit:
  • Can you reproduce the bug at Examples:
    • Yes (provide example code)
    • No
    • Not relevant
  • Provide example code:
        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)
  • Log gist:
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/[email protected]/data/dict/dictionary.txt]
2021/01/08 14:36:33 Load the gse dictionary: "/Users/zc/go/pkg/mod/github.com/go-ego/[email protected]/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

...

@zc2638
Copy link
Author

zc2638 commented Jan 13, 2021

@vcaesar

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant