A customer wanted to see a list of users sorted by last name, which seemed pretty simple. The data is already in the search index, and a simple REST call should be all that’s needed, I assumed.
The REST call:
The above should return all users (since I’m using the predefined source id that points to the user profile search result) whose last names begin with “d”, and the results should be sorted by lastname, ascending. However, this yielded results like:
As an aside, there is an additional problem with the REST call, above. Specifically, “lastname:d*” seems pretty simple and self-explanatory. However, SharePoint doesn’t interpret this as looking for last names that begin with “d”, it apparently interprets this looking for last names that have a word that begins with “d”. So this REST query will return the following: