예제 #1
0
        public static List<dotSearchResult> BingSearch(string search_expression)
        {
            List<dotSearchResult> results_list = new List<dotSearchResult>();

            using (BingService searchService = new BingService())
            {
                SearchRequest searchRequest = new SearchRequest();
                searchRequest.AppId = "36149AF47B0C19CE5FCAE52FFA14101135EA61D9";
                searchRequest.Query = search_expression;
                searchRequest.Sources = new SourceType[] { SourceType.Web };
                searchRequest.Web = new net.live.search.api.WebRequest();
                searchRequest.Web.Count = 50;
                searchRequest.Web.CountSpecified = true;
                searchRequest.Web.Offset = 0;
                searchRequest.Web.OffsetSpecified = true;

                SearchResponse searchResponse = new SearchResponse();
                searchResponse = searchService.Search(searchRequest);

                int i = 1000;

                foreach (WebResult result in searchResponse.Web.Results)
                {
                    dotSearchResult temp = new dotSearchResult();
                    temp.pageUrl = result.Url;
                    temp.pageTitle = result.Title;
                    temp.pageDescription = result.Description;
                    temp.dotPriority = i++;
                    temp.engine = dotSearchEngine.Bing;

                    results_list.Add(temp);
                }
            }

            return results_list;
        }
예제 #2
0
 /// <remarks/>
 public void SearchAsync(SearchRequest parameters, object userState) {
     if ((this.SearchOperationCompleted == null)) {
         this.SearchOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSearchOperationCompleted);
     }
     this.InvokeAsync("Search", new object[] {
                 parameters}, this.SearchOperationCompleted, userState);
 }
예제 #3
0
 /// <remarks/>
 public void SearchAsync(SearchRequest parameters) {
     this.SearchAsync(parameters, null);
 }
예제 #4
0
 public SearchResponse Search(SearchRequest parameters) {
     object[] results = this.Invoke("Search", new object[] {
                 parameters});
     return ((SearchResponse)(results[0]));
 }