People Search: "Total" field value is incorrect - causing issue with pagination

CF_Harsha 0 Reputation points
2023-04-20T13:01:30.95+00:00

MS Graph API : People Search endpoint is returning incorrect values in "Total" field of the response. This is causing a problem when Paging is enabled on PnP Modern Search webpart - people results use cases. We can observe this (incorrect) behavior for messages and bookmarks search endpoints as well.

For example, when searching for people (using graph explorer) for

Case 1: keyword "test", (without specifying any specific size) the total number of people returned are - 7People Search-GraphAPI Response 1

Case 2: keyword "test", (with specifying "3" size) to get 3 results per page. Issue is the "total" changed to 3 instead of actual 7. People Search-GraphAPI Response 2

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,445 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-04-21T05:52:18.0633333+00:00

    Hello CF_Harsha,

    Thanks for reaching out!

    It is an expected behavior that you are getting different results while using different from and size using search query. The search results returned by the Microsoft Search API are based on the data available at the time of the search query. If the underlying data changes between different paginated requests, such as new documents being added or existing documents being updated or deleted, the search results may be different on subsequent pages.

    Please refer to the documentation for more details.

    Hope this helps.

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