public IHttpActionResult GetSimilarTitles(SearchTopic searchTopic) { var results = this.Get <ISearch>().SearchSimilar( searchTopic.UserId, string.Empty, searchTopic.SearchTerm, "Topic"); if (results == null) { return(this.Ok( new SearchGridDataSet { PageNumber = 0, TotalRecords = 0, PageSize = 0 })); } return(this.Ok( new SearchGridDataSet { PageNumber = 1, TotalRecords = results.Count, PageSize = 20, SearchResults = results })); }
public void Fight(string[] SearchTopics) { foreach (var query in SearchTopics) { SearchTopic topic = new SearchTopic { Topic = query, ParsedTopic = parseQuery(query), Results = new List <SearchResult>() }; foreach (var engine in SearchEngines) { SearchResult oResult = new SearchResult(); oResult.string_result = engine.obtainEngineResult(topic.ParsedTopic); oResult.result = engine.parseResult(oResult.string_result); oResult.Engine = engine.getEngineName(); topic.Results.Add(oResult); } Topics.Add(topic); } }
public IHttpActionResult GetUsers(SearchTopic searchTopic) { if (!BoardContext.Current.IsAdmin && !BoardContext.Current.IsForumModerator) { return(this.NotFound()); } var users = this.Get <IUserDisplayName>().FindUserContainsName(searchTopic.SearchTerm); if (!users.Any()) { return(this.NotFound()); } var usersFound = users .Select( user => new SelectOptions { text = user.DisplayOrUserName(), id = user.ID.ToString() }).ToList(); var pagedTopics = new SelectPagedOptions { Total = usersFound.Count, Results = usersFound }; return(this.Ok(pagedTopics)); }
public IHttpActionResult GetTopics(SearchTopic searchTopic) { if (!BoardContext.Current.IsAdmin && !BoardContext.Current.IsForumModerator) { return(this.NotFound()); } if (searchTopic.SearchTerm.IsSet()) { var topics = this.Get <IDataCache>().GetOrSet( $"TopicsList_{searchTopic.ForumId}", () => this.GetRepository <Topic>().Get(t => t.ForumID == searchTopic.ForumId), TimeSpan.FromMinutes(5)); var topicsList = topics .Where(topic => topic.TopicName.ToLower().Contains(searchTopic.SearchTerm.ToLower())) .Select( topic => new SelectOptions { text = topic.TopicName, id = topic.ID.ToString() }).ToList(); var pagedTopics = new SelectPagedOptions { Total = 0, Results = topicsList }; return(this.Ok(pagedTopics)); } else { var topics = this.GetRepository <Topic>().ListAsDataTable( searchTopic.ForumId, null, DateTimeHelper.SqlDbMinTime(), DateTime.UtcNow, searchTopic.Page, 15, false, false, false); var topicsList = (from DataRow topic in topics.Rows select new SelectOptions { text = topic["Subject"].ToString(), id = topic["TopicID"].ToString() }).ToList(); var topicsEnum = topics.AsEnumerable(); var pagedTopics = new SelectPagedOptions { Total = topicsEnum.Any() ? topicsEnum.First().Field <int>("TotalRows") : 0, Results = topicsList }; return(this.Ok(pagedTopics)); } }
public static void ReadTopicResults(SearchTopic topic) { Console.WriteLine("Search {0}", topic.Topic); foreach (var result in topic.Results) { Console.WriteLine("\t {0}: {1}", result.Engine, result.result); } }
public IHttpActionResult GetSearchResults(SearchTopic searchTopic) { var results = this.Get <ISearch>().SearchPaged( out var totalHits, searchTopic.ForumId, searchTopic.UserId, searchTopic.SearchTerm, searchTopic.Page, searchTopic.PageSize); return(this.Ok( new SearchGridDataSet { PageNumber = searchTopic.Page, TotalRecords = totalHits, PageSize = searchTopic.PageSize, SearchResults = results })); }
public LoadSearchItem() { // 搜索主面板 Load.SearchPal = new App.Style.SearchItemBarPal { Location = new System.Drawing.Point(77, 47 - 10) }; App.Style.Helper.Ui.Controls.Add(Load.SearchPal); // 搜索导航面板 Load.SearchNavPal = new App.Style.SearchNavBarPal { Location = new System.Drawing.Point(0, 0) }; Load.SearchPal.Controls.Add(Load.SearchNavPal); // 搜索列表面板 Load.SearchItemPal = new App.Style.SearchItemBarFly { Location = new System.Drawing.Point(0, Load.SearchNavPal.Size.Height) }; Load.SearchPal.Controls.Add(Load.SearchItemPal); // 搜索专题面板 SearchTopic.LoadSearchTopic(); SearchInput.LoadSearchInput(); }