示例#1
0
        public ISearchResult Search(string phrase)
        {
            phrase = Utils.PhraseWithoutPrefix(phrase, Prefix);

            var result = FileIndexSearch.ExecuteQuery(phrase);
            var searchResult = new ListSearchResult(result.Select(fsr => MapFileSearchRresult(fsr)), Name);
            searchResult.SearchIcon = SearchIcon;
            return searchResult;
        }
示例#2
0
        public ISearchResult Search(string phrase)
        {
            phrase = Utils.PhraseWithoutPrefix(phrase, Prefix);

            var hc = new HttpClient();
            var webResultHc = hc.GetStringAsync(string.Format("http://www.wikipedia.org/w/api.php?action=query&list=search&srsearch={0}&srprop=timestamp&format=json", HttpUtility.UrlEncode(phrase)));
            var webResult = webResultHc.Result;

            var wikiResults = ParseResult(webResult);
            var result = new ListSearchResult(wikiResults.Select(wsr => MapWikiSearch(wsr)), "Wikipedia");
            result.SearchIcon = SearchIcon;
            return result;
        }
示例#3
0
        public ISearchResult Search(string phrase)
        {
            phrase = Utils.PhraseWithoutPrefix(phrase, Prefix);

            var wc = new WebClient();
            wc.Encoding = Encoding.UTF8;

            var hc = new HttpClient();
            var webResultHc = hc.GetStringAsync(string.Format("http://www.google.pl/search?q={0}", HttpUtility.UrlEncode(phrase)));
            var webResult = webResultHc.Result;

            var googleResults = ParseResult(webResult);
            var result = new ListSearchResult(googleResults.Select(gsr => MapGoogleSearch(gsr)), "Google");
            result.SearchIcon = SearchIcon;
            return result;
        }