Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [WebMethod]
- public static String GetTopDocuments(string SearchText, string RelativeSearchPath, string ResourceTypes, string LinkedListUrl, string Program)
- {
- if (SPUtility.ValidateFormDigest())
- {
- string siteUrl = SPContext.Current.Site.Url;
- if (!string.IsNullOrEmpty(Program))
- {
- Program = string.Format(@" Program:""{0}"" ", Program);
- }
- //for when pages can be searchable
- string queryConstant = @"(path:""{0}{1}"" contenttype:""Halton Document"" {2} {3}) OR (contenttype:""Page"" {2} {3}) ";
- string query = string.Format(queryConstant, siteUrl, RelativeSearchPath, ResourceTypes, Program);
- if (!string.IsNullOrEmpty(LinkedListUrl))
- {
- query = "(" + query + @") OR (path:""" + LinkedListUrl + @"/DispForm.aspx*"" " + ResourceTypes + Program + " ) " + SearchText;
- }
- List<TopDocument> topDocuments = HaltonContext.GetTopDocuments(siteUrl, HaltonContext.Search(siteUrl, query));
- var jsonSerialiser = new JavaScriptSerializer();
- return jsonSerialiser.Serialize(topDocuments);
- }
- return "error";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement