Issues with Typesense Search Results Limit

TLDR Adrian is trying typesense for the first time and encounters an issue with search results being limited to 10 hits. Kishore Nallan suggests sending 'max_candidates: 1000' as a search option.

Photo of Adrian
Adrian
Wed, 01 Mar 2023 02:54:19 UTC

Hey there :wave: I'm trying typesense for the first time and for the purpose of learning I threw together a very simple collection with this schema: ```{ name: 'accounts', fields: [ { name: 'username', type: 'string', facet: false, }, { name: 'email', type: 'string', facet: false, }, ], }``` And dumped a bunch of random data in there with that structure, if I use this code to search: ```const accounts = await typesenseClient .collections<Omit<Account, 'password'>>('accounts') .documents() .search( { q: 'Ma', query_by: 'username', page: 1, per_page: 20, include_fields: 'username', }, { cacheSearchResultsForSeconds: 0, } );``` It will return ONLY 10 hits, even though I know for a fact there should be more documents with the username starting with `Ma` (same thing happens for different searches, it doesn't go over 10) - if the `q` param is set to `*` it will show all the 1K+ docs available in that collection. What am I missing? I've followed the setup guide from here

Photo of Kishore Nallan
Kishore Nallan
Wed, 01 Mar 2023 03:03:43 UTC

Try sending 'max_candidates: 1000' as a search option.