예제 #1
0
        private void setSearchUrl()
        {
            SearchUrl = String.Format("{0}/SearchResults.aspx", SiteUtils.GetNavigationSiteRoot());

            if (Request.IsSecureConnection)
            {
                if ((CurSettings != null) && (!CurSettings.UseSslOnAllPages))
                {
                    SearchUrl = SearchUrl.Replace("https", "http");
                }
            }
        }
예제 #2
0
        public override List <SearchResultItem> Search(string query, string category = null)
        {
            List <SearchResultItem> results = new List <SearchResultItem>();
            string  searchUrl = SearchUrl.Replace("{term}", HttpUtility.UrlEncode(query));
            JObject json      = GetWebData <JObject>(searchUrl);

            if (json["_embedded"] != null && json["_embedded"]["formats"] != null && json["_embedded"]["formats"].Count() > 0)
            {
                foreach (JToken format in json["_embedded"]["formats"])
                {
                    results.Add(new RssLink()
                    {
                        Name             = format["title"].Value <string>(),
                        Url              = format["_links"]["self"]["href"].Value <string>(),
                        Thumb            = format["_links"]["image"]["href"].Value <string>().Replace("{size}", "230x150"),
                        HasSubCategories = true,
                        Other            = "title"
                    });
                }
            }
            return(results);
        }