SharePoint online search Rest API returning different totalrows value sometimes without change in data

Chandna, Ashish 0 Reputation points
2023-04-13T11:45:27.31+00:00

I am using SharePoint search Rest API to identify the total rows available for a specific query. I am getting different value for TotalRows variable sometimes without change in query. I have used TrimDuplicates:False as well to try to keep the count consistent but the results are different sometimes. I am using SharePoint online and code is written in SPFX using React.

Microsoft 365 and Office SharePoint Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2023-04-14T03:37:17.5833333+00:00

    Hi @Chandna, Ashish

    The count returned for search results is not an accurate number. That is why it says "About 410 results". Every time you change pages, the query is executed and SharePoint takes another guess at how many results are found, even though the query has not changed.

    That is also why there is `ResultTable.IsTotalRowsExact` property which will be true if TotalRows is the exact number of results returned.

    You can see the similar issue with yours

    https://stackoverflow.com/questions/58137986/sharepoint-search-rest-api-returns-inconsistent-total-rows-count The issue also can be caused by crawler. And will be fixed on its own in the next crawl.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.