Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev guideRecipesAPI Reference
Dev guideUser GuidesLegal TermsNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Total hits selection

Select total hits for query.

👍

Beta

The Optimizely Graph .NET Client is in beta. Contact your Customer Success Manager for information.

The Total method will add the total field to your response and hold the value of the total documents found depending on your query. This is useful to show at the top of the list, table, map or any form of Search Engine Results Page (SERP).

By default, Optimizely Graph shows accurate hit counts until 10,000 results. When there are more, it will show a -1 to significantly improve the request times of queries.

var query = queryBuilder
.ForType<MyDocumentType>()
  .Total()
.ToQuery()
.BuildQueries();

If accurate hit counts are important, you can add the optional input Boolean argument all to the total field. By default, you can omit this input argument, which is set to false.

var query = queryBuilder
.ForType<MyDocumentType>()
  .Total(true)
.ToQuery()
.BuildQueries();