SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.24k stars 1k forks source link

Search limits results to 4 if I include the selectproperties query string parameter #3261

Closed colinrippeyfinarne closed 4 years ago

colinrippeyfinarne commented 5 years ago

I have found a strange issue with this REST API that I can replicate on different tenants.

If I use a simple GET call such as:

https://mytentant.sharepoint.com/_api/search/query?querytext=%27conf%27&selectproperties=%27PreferredName,WorkEmail,PictureURL,WorkPhone%27&sortlist=%27LastName:ascending%27&sourceid=%27b09a7990-05ea-4af9-81ef-edfab16c4e31%27&rowlimit=500

I get back 4 results only, I should get back 6.

If I remove the selectproperties parameter I get ALL the results I expect.

To test this I created a demo tenant from the Microsoft Partner site https://demos.microsoft.com and simply searched for the text 'conf' as there are a bunch of test users that are Conf Room xxx.

I can replicate this issue on different tenants using different search terms that should return more than 4 results but each time I only get back 4 results, if I do choose to remove the selectproperties parameter I get back all the results I expect to see.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

msft-github-bot commented 5 years ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

colinrippeyfinarne commented 5 years ago

Any feeback on this?

bcameron1231 commented 5 years ago

Hi @colinrippeyfinarne I've tried to reproduce this issue. Can you clarify, did you say all of the results get returned from the Demo tenant?

Can you provide any more information on your search environment? Using Query Rule? Use Custom Result sources?

colinrippeyfinarne commented 5 years ago

Hi @bcameron1231 as above I can re-create this issue on our PROD tenant.

If I can "try" to demo, the screen shot below shows me sending a query for users with the Surname Watson (that I know there are more than 4 of but the query is returning only 4):

image

Next, here is the exact same query but if I remove the selectproperties from the query string I get back all the results I expect:

image

The root of this issue is from the SharePoint Starter Kit People Directory pages. The free text search for people is only returning four results and when I am tracing the calls in fiddler I see the raw request as I've tried to explain above.

colinrippeyfinarne commented 5 years ago

@bcameron1231 here's another example using a simple Demo tenant I created this morning via https://demos.microsoft.com

I have the following raw url (I am searching for the letter A so expecting tons of results):

https://m365x019802.sharepoint.com/_api/search/query?querytext=%27A%27&selectproperties=%27PreferredName,WorkEmail,PictureURL,WorkPhone%27&sortlist=%27LastName:ascending%27&sourceid=%27b09a7990-05ea-4af9-81ef-edfab16c4e31%27&rowlimit=500

I see this:

image

And if I remove the selectproperties from the querystring I see this:

image

So I can recreate this, and for our site using the Starter kit it is causing an issue.

bcameron1231 commented 5 years ago

I am at a loss... I created a new demo tenant from demos.microsoft.com this morning and I have copied your query. It returned 19 records for me...

https://m365x957771.sharepoint.com/_api/search/query?querytext=%27A%27&selectproperties=%27PreferredName,WorkEmail,PictureURL,WorkPhone%27&sortlist=%27LastName:ascending%27&sourceid=%27b09a7990-05ea-4af9-81ef-edfab16c4e31%27&rowlimit=500

image

colinrippeyfinarne commented 5 years ago

@bcameron1231 thanks for taking the time to check, I am at a loss too as no idea why I am seeing this either?

Think I need to (for whatever reason) rule out the network connectivity I am going through "in case" there's some strange throttle going on (clutching at straws really).

colinrippeyfinarne commented 5 years ago

@bcameron1231 can you humour me for one min, in your browser session where you are seeing the 19 results, can you duplicate the tab and resubmit the query in the duplicate tab and check the results?

I am "able" to re-create the search returning all 19 results, but then if I try again in another tab it only returns 4 (tried this on chrome, firefox). If I leave both tabs open I and then after few mins I do a CTRL F5 I get back 4 in one and 19 in the other but randomly in each one, not the same tab always getting 4 and the other getting 19 (almost as if I might be hitting a different query front end each time).

I can see this behaviour this on my current client's laptop, and on my own personal laptop going out over a totally different network.

bcameron1231 commented 5 years ago

@colinrippeyfinarne That does it. I followed your repro steps above. It actually doesn't require a new tab. If you do Empty Cache + Hard Reload, you will get 4 returned rows, even though the query says 19 items should be returned.

@VesaJuvonen looks like this might need to be looked at more closely as a possible bug.

colinrippeyfinarne commented 5 years ago

@bcameron1231 thank you! At least I now know I'm not going mad lol.

bcameron1231 commented 5 years ago

@colinrippeyfinarne Was this ever resolved in your environment?

colinrippeyfinarne commented 5 years ago

@bcameron1231 looks like there's been a change to the back-end and the above urls no longer work for me?

bcameron1231 commented 5 years ago

@colinrippeyfinarne It's likely the demo environments expired. I'm just wondering if it's been fixed on your end or if this is still an open ticket.

colinrippeyfinarne commented 5 years ago

@bcameron1231 no my demo tenant is still fine - I had just pasted the url into a browser window and it failed with access denied and I then "logged in properly" and tried again and I am getting the results back now. I'll need to now test if the issue is still appearing.

colinrippeyfinarne commented 5 years ago

@bcameron1231 looks like I'm still seeing the same issue as before, I am getting back 4 rows and (sometimes) more than 4 if I do a force refresh I get more than 4.

mickyc1 commented 5 years ago

This is happening me on every request no matter what browser or how times I force refresh. Anyone know of any way to fix this?

msft-github-bot commented 4 years ago

This issue is being closed as part of an issue list cleanup project. Issues with no activity in the past 6 months that aren't tracked by engineering as bugs were closed as part of this inititive. If this is still an issue, please follow the steps outlined to re-open the issue.