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 473 forks source link

support some methods to return all docs when text is empty #45

Closed bloodynumen closed 6 years ago

bloodynumen commented 6 years ago

Like this:

searcher.Search(types.SearchReq{
    TextMayBeEmpty: true,
    Text: "",
    RankOpts: &types.RankOpts{
        OutputOffset: 0,
        MaxOutputs:   100,
    },
})

It's useful for providing web api

vcaesar commented 6 years ago

You can use spaces " " to return all docs:

searcher.Search(types.SearchReq{
    Text: " ",
    RankOpts: &types.RankOpts{
        OutputOffset: 0,
        MaxOutputs:   100,
    },
})
bloodynumen commented 6 years ago

@vcaesar thank you~