When I try to make a search query with bleve I always get 10 or less results. How can I increase this limit or make a search between all the data?
Here is code example, where I expect to get 35 results, but getting 10 (ps calc.Rand()
function is giving random bytes):
package search
import (
"testing"
"github.com/blevesearch/bleve/v2"
)
func TestSearcher(t *testing.T) {
mapping := bleve.NewIndexMapping()
searcher, _ := bleve.New("search/src", mapping)
for i := 0; i < 35; i++ {
searcher.Index(string(calc.Rand()), "stuff")
}
query := bleve.NewMatchQuery("stuff")
search := bleve.NewSearchRequest(query)
searchRez, _ := searcher.Search(search)
t.Error(len(searchRez.Hits))
}
Result I get:
--- FAIL: TestSearcher (2.33s)
/Users/ ... /search/search_test.go:86: 10
Result I expect:
--- FAIL: TestSearcher (2.33s)
/Users/ ... /search/search_test.go:86: 35
How do I access all the 35 values, that are stored by this index?
Set the field
Size
onSearchRequest
:or with pagination, you set the field
From
incrementally based on page size. A contrived example: