Reputation: 121
We are a building a custom web part with pagination feature. To implement this feature we are getting a total rows count and showing the possible number of pages.
While implementing this, we are running queries using the startRow and rowLimit query string parameters. When I change the startRow query string parameter, the TotalRows attribute returns a different number for the same queryText.
Example:
https://tenant.sharepoint.com/_api/search/query?querytext='test'&startrow=0&rowLimit=10 returns TotalRows 125
https://tenant.sharepoint.com/_api/search/query?querytext='test'&startrow=10&rowLimit=10 returns TotalRows 112
But the TotalRowsInclusingDuplicates property returns a consistent value. However, If I try to use start row above the TotalRows count it returns 0 results.
I am wondering why Rows Count is varied by StartRow.
Is anyone facing the same issue or have any suggestions?
Upvotes: 1
Views: 1297
Reputation: 235
For those who search how to fix the issue -
Issue is appearing only when duplicate trimming is turned On. To fix the issue try to turn duplicate trimming Off.
If you use Rest to retrieve search results - Append &trimduplicates=false
In other cases this article may help.
Upvotes: 1
Reputation: 1231
The same happens in a browser search. At the bottom of the first page of results you might see 746, on the next page 698 and next 752. They are all estimates. They generally get closer to the correct value as you approach the last page of results.
i.e. SharePoint does not even try to guess the number of search pages.
This is from my SharePoint Search course...
Upvotes: 3