go-ego / riot

Go Open Source, Distributed, Simple and efficient Search Engine; Warning: This is V1 and beta version, because of big memory consume, and the V2 will be rewrite all code.
Apache License 2.0
6.11k stars 475 forks source link

Digital fuzzy query does not work #124

Open zc2638 opened 3 years ago

zc2638 commented 3 years ago
  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.

        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)


## Description

...
zc2638 commented 3 years ago

@vcaesar