How to increase the totalresults count? currently it is capped to 10000

We have around 35k records ingested in the appsearch engine. when we do the default search without any searchTerm it gives 10000 as the totalResults count instead of 35000 even though the user may not scroll through all the 35k records. does the AppSearch actually searches the full 35k docs or will it only searches the 10k documents as it says 10k results only.

Hi Mecadamia.nut,

App Search does search over all the documents in your engine, it just limits the size of the documents returned as a query result to 10,000.

Thanks James. Is there a way to show the full number rather than showing 10000?

Hi @Mecadamia.nut !

When there are more than 10,000 matches, the number of results will be fixed to 10,000. You can use that information in your UI (displaying "10,000+" for example).

In case you need to exactly count the number of results beyond 10,000, you can use facets. Check display the total number of search results in the Search Guide for guidance on how to achieve an exact count of results.

Hope this helps!

Thanks Carolos. I am able to add the facet count for each of them and then show the result count now.

  function getTotalResultsCount(mainfilter, filters, totalcount) {
    if (totalcount && totalcount < 10000 && filters.length != 0)
      return totalcount;
    let totalCount = 0;
    mainfilter.map(s => {
      var data = s.data;
      data.forEach(element => {
        if (filters.length === 0)
          totalCount += element.count;
        else
          filters.map(f => {
            if (f.values.indexOf(element.value) != -1)
              totalCount += element.count;
          })
      })
    });
    return totalCount;
  }

...
                              {wasSearched && <><PagingInfo
                                mapContextToProps={context => {
                                  if (!context.facets.mainfilter) return context;
                                  return {
                                    ...context,
                                    totalResults: getTotalResultsCount(context.facets.mainfilter, context.filters, context.totalResults),
                                  };
                                }}
                                view={({ start, end, totalResults, searchTerm }) => (
                                  <div className="paging-info">
                                    <span>Showing <strong>{start}</strong> - <strong>{end}</strong> out of <strong>
                                      {totalResults} </strong>{searchTerm && searchTerm.length > 0 && <span>for:</span>}<i>{searchTerm}</i>
                                      <Paging className="classPaging" /></span>

                                  </div>
                                )}
                              /> </>}


1 Like

Nice! Thanks for sharing your solution!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.