Exemplo n.º 1
0
        public override async Task <SearchResult> Search(string term)
        {
            Config.Parameters["q"] = term.Replace(" ", "+");

            try
            {
                var result = await WebServiceConsumer.ConsumeAsync <GoogleSearchResult>(Url);

                var mappedResult = Map(result, term);

                return(mappedResult);
            }
            catch (Exception ex)
            {
                //TODO: Log ex to a target
                return(new SearchResult
                {
                    SearchEngine = EngineName,
                    SearchTerm = term,
                    ResultsCount = 0,
                    Status = SearchResultStatus.Error,
                    ErrorMessage = "There was an issue"
                });
            }
        }