I'm trying to use the REST api on a SharePoint online site to get results that are only documents. My query string looks like this:



rowlimit = 2  
Source ID = e7ec8cee-ded8-43c9-beb5-436b54b31e84  
Select Properties = Path,Title,HitHighlightedSummary,FileType  

This works fine on a regular SharePoint solution, but not at all on SharePoint Online. The query always returns the exact same documents, regardless of what querytext I put in. The same are even return if I type something like 'kshdgaibl akjrhgpiauerhpiae'...

I have double checked that the source ID is correct. If I remove the source ID entierly the correct documents show up, along with other result sources. And if I go to the search center and type in the same text, I get the documents and other results.

Does anyone have an idea why this could be?


I found that the search center had the same behaviour if you configured a result page to point to those out of the box result sources. On further investigation I found that unless you were using a result source already pointed to by the out of the box search center they were missing the "?{searchTerms}" part of the query text.

I can't find any reference to these being fixed/changed in any update released so far. But you can copy these result sources and add the ?{searchTerms} in. You can then reference your result sources and it should be fine.

  • Hi Can you pls update your answer with the actual query – spStacker Sep 19 '16 at 14:23

Turns out there seems to be a bug in the document result source. This happens when it can't find any documents results. It then returns some anyway, and the same ones everytime. But only if you make the request via REST, not the search center.

  • 1
    Haha, seems like not so nice functionality there! – Robert Lindgren Nov 19 '13 at 8:34
  • Funny thing, the same seems to happen in standard =) – stinaq Nov 19 '13 at 13:09
  • Did you find out that this is really a known sharepoint bug? I have exactly same problem. – Tolga Dec 18 '15 at 11:50
  • Hi Stinaq.. Pls mark David MsEwing As answer..The missing {searchTerms} is the what the out of box 'document result source' is missing. – spStacker Sep 19 '16 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.