コード例 #1
0
        public IList<INewsResult> getTopicQueryResults(String query)
        {
            GnewsSearchClient client = new GnewsSearchClient("http://hopepointe.org");

               IList<INewsResult> result = client.Search(query, 32, null, SortType.Relevance, null, null, NewsEdition.UnitedStates);
               //keyword, resultCount, geo, sortBy, quoteId, topic, edition
               //SortType.Relevance
               //NewsTopic.World

               return result;
        }
コード例 #2
0
 public IList<INewsResult> getNewsQueryResults(String query)
 {
     GnewsSearchClient client = new GnewsSearchClient("http://hopepointe.org");
        IList<INewsResult> result = client.Search(query, 32);
        return result;
 }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: nigihayami/TestApi
        /// <summary>
        /// Поиск
        /// </summary>
        /// <param name="searchText">Текст для поиска</param>
        /// <param name="mode">Тип поиска</param>
        /// <returns></returns>
        private List<SearchResultModel> Search(string searchText, int mode)
        {
            var resultOut = new List<SearchResultModel> { };
            switch (mode)
            {
                case 1:
                    GnewsSearchClient t = new GnewsSearchClient("");
                    var SearchResult = t.Search(searchText, 10);
                    foreach (var item in SearchResult)
                    {
                        resultOut.Add(new SearchResultModel { ClusterUrl = item.ClusterUrl, Content = item.Content, Num = 0 });
                    }
                    break;
                case 2:
                    GvideoSearchClient t2 = new GvideoSearchClient("");
                    var SearchResult2 = t2.Search(searchText, 10);
                    foreach (var item in SearchResult2)
                    {
                        resultOut.Add(new SearchResultModel { ClusterUrl = item.PlayUrl, Content = item.Content, Num = 0 });
                    }
                    break;
                case 3:
                    GblogSearchClient t3 = new GblogSearchClient("");
                    var SearchResult3 = t3.Search(searchText, 10);
                    foreach (var item in SearchResult3)
                    {
                        resultOut.Add(new SearchResultModel { ClusterUrl = item.BlogUrl, Content = item.Content, Num = 0 });
                    }
                    break;
                case 4:
                    GwebSearchClient t4 = new GwebSearchClient("");
                    var SearchResult4 = t4.Search(searchText, 10);
                    foreach (var item in SearchResult4)
                    {
                        resultOut.Add(new SearchResultModel { ClusterUrl = item.Url, Content = item.Content, Num = 0 });
                    }
                    break;

            }
            return resultOut;
        }