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.
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
Post a Comment