SharePoint Search: How do I limit a search query to a specific site collection?

The url needs to be as follows (as per this entry):

http://localhost/_api/search/query?querytext='test+path:"http://localhost/subsite/"'

The C# code the create the querystring is as follows:

string searchRestUrl = "/_api/search/query?querytext='" + text + "+%2b+path:\"" + HttpUtility.UrlEncode(SiteUrl) + "\"'&rowlimit=5";

where SiteUrl is the full url for my site.

Comments

Popular posts from this blog

SharePoint 2013: Error updating managed account credentials

Error deploying Nintex workflow: An item with the same key has already been added