Ejemplo n.º 1
0
        /// <summary>
        /// 群组全局搜索
        /// </summary>
        public ActionResult _GlobalSearch(GroupFullTextQuery query, int topNumber)
        {
            query.PageSize  = topNumber;//每页记录数
            query.PageIndex = 1;

            //调用搜索器进行搜索
            GroupSearcher groupSearcher        = (GroupSearcher)SearcherFactory.GetSearcher(GroupSearcher.CODE);
            PagingDataSet <GroupEntity> groups = groupSearcher.Search(query);

            return(PartialView(groups));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 群组快捷搜索
        /// </summary>
        public ActionResult _QuickSearch(GroupFullTextQuery query, int topNumber)
        {
            query.PageSize  = topNumber;//每页记录数
            query.PageIndex = 1;
            query.Range     = GroupSearchRange.GROUPNAME;
            query.Keyword   = Server.UrlDecode(query.Keyword);
            //调用搜索器进行搜索
            GroupSearcher GroupSearcher        = (GroupSearcher)SearcherFactory.GetSearcher(GroupSearcher.CODE);
            PagingDataSet <GroupEntity> groups = GroupSearcher.Search(query);

            return(PartialView(groups));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 群组搜索
        /// </summary>
        public ActionResult Search(GroupFullTextQuery query)
        {
            query.Keyword  = WebUtility.UrlDecode(query.Keyword);
            query.PageSize = 20;//每页记录数

            //调用搜索器进行搜索
            GroupSearcher groupSearcher        = (GroupSearcher)SearcherFactory.GetSearcher(GroupSearcher.CODE);
            PagingDataSet <GroupEntity> groups = groupSearcher.Search(query);

            //添加到用户搜索历史
            IUser CurrentUser = UserContext.CurrentUser;

            if (CurrentUser != null)
            {
                if (!string.IsNullOrWhiteSpace(query.Keyword))
                {
                    SearchHistoryService searchHistoryService = new SearchHistoryService();
                    searchHistoryService.SearchTerm(CurrentUser.UserId, GroupSearcher.CODE, query.Keyword);
                }
            }

            //添加到热词
            if (!string.IsNullOrWhiteSpace(query.Keyword))
            {
                SearchedTermService searchedTermService = new SearchedTermService();
                searchedTermService.SearchTerm(GroupSearcher.CODE, query.Keyword);
            }

            //设置页面Meta
            if (string.IsNullOrWhiteSpace(query.Keyword))
            {
                pageResourceManager.InsertTitlePart("群组搜索");//设置页面Title
            }
            else
            {
                pageResourceManager.InsertTitlePart('“' + query.Keyword + '”' + "的相关群组");//设置页面Title
            }

            return(View(groups));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 可能感兴趣的群组
        /// </summary>
        public ActionResult _InterestGroup()
        {
            TagService tagService  = new TagService(TenantTypeIds.Instance().User());
            IUser      currentUser = UserContext.CurrentUser;

            if (currentUser != null)
            {
                GroupFullTextQuery query = new GroupFullTextQuery();
                query.PageSize  = 20;
                query.PageIndex = 1;
                query.Range     = GroupSearchRange.TAG;
                query.Tags      = tagService.GetTopTagsOfItem(currentUser.UserId, 100).Select(n => n.TagName);
                query.GroupIds  = groupService.GetMyJoinedGroups(currentUser.UserId, 100, 1).Select(n => n.GroupId.ToString());
                //调用搜索器进行搜索
                GroupSearcher             GroupSearcher = (GroupSearcher)SearcherFactory.GetSearcher(GroupSearcher.CODE);
                IEnumerable <GroupEntity> groupsTag     = null;
                if (GroupSearcher.Search(query, true).Count == 0)
                {
                    return(View());
                }
                else
                {
                    groupsTag = GroupSearcher.Search(query, true).AsEnumerable <GroupEntity>();
                }
                if (groupsTag.Count() < 20)
                {
                    IEnumerable <GroupEntity> groupsFollow = groupService.FollowedUserAlsoJoinedGroups(currentUser.UserId, 20 - groupsTag.Count());
                    return(View(groupsTag.Union(groupsFollow)));
                }
                else
                {
                    return(View(groupsTag));
                }
            }
            else
            {
                return(View());
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 群组快捷搜索
        /// </summary>
        public ActionResult _QuickSearch(GroupFullTextQuery query, int topNumber)
        {
            query.PageSize = topNumber;//每页记录数
            query.PageIndex = 1;
            query.Range = GroupSearchRange.GROUPNAME;
            query.Keyword = Server.UrlDecode(query.Keyword);
            //调用搜索器进行搜索
            GroupSearcher GroupSearcher = (GroupSearcher)SearcherFactory.GetSearcher(GroupSearcher.CODE);
            PagingDataSet<GroupEntity> groups = GroupSearcher.Search(query);

            return PartialView(groups);
        }
Ejemplo n.º 6
0
 public ActionResult _InterestGroup()
 {
     TagService tagService = new TagService(TenantTypeIds.Instance().User());
     IUser currentUser = UserContext.CurrentUser;
     if (currentUser != null)
     {
         GroupFullTextQuery query = new GroupFullTextQuery();
         query.PageSize = 20;
         query.PageIndex = 1;
         query.Range = GroupSearchRange.TAG;
         query.Tags = tagService.GetTopTagsOfItem(currentUser.UserId, 100).Select(n => n.TagName);
         query.GroupIds = groupService.GetMyJoinedGroups(currentUser.UserId, 100, 1).Select(n => n.GroupId.ToString());
         //调用搜索器进行搜索
         GroupSearcher GroupSearcher = (GroupSearcher)SearcherFactory.GetSearcher(GroupSearcher.CODE);
         IEnumerable<GroupEntity> groupsTag = null;
         if (GroupSearcher.Search(query, true).Count == 0)
         {
             return View();
         }
         else
         {
             groupsTag = GroupSearcher.Search(query, true).AsEnumerable<GroupEntity>();
         }
         if (groupsTag.Count() < 20)
         {
             IEnumerable<GroupEntity> groupsFollow = groupService.FollowedUserAlsoJoinedGroups(currentUser.UserId, 20 - groupsTag.Count());
             return View(groupsTag.Union(groupsFollow));
         }
         else
         {
             return View(groupsTag);
         }
     }
     else
     {
         return View();
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 群组全局搜索
        /// </summary>
        public ActionResult _GlobalSearch(GroupFullTextQuery query, int topNumber)
        {
            query.PageSize = topNumber;//每页记录数
            query.PageIndex = 1;

            //调用搜索器进行搜索
            GroupSearcher groupSearcher = (GroupSearcher)SearcherFactory.GetSearcher(GroupSearcher.CODE);
            PagingDataSet<GroupEntity> groups = groupSearcher.Search(query);

            return PartialView(groups);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 群组搜索
        /// </summary>
        public ActionResult Search(GroupFullTextQuery query)
        {
            query.Keyword = WebUtility.UrlDecode(query.Keyword);
            query.PageSize = 20;//每页记录数

            //调用搜索器进行搜索
            GroupSearcher groupSearcher = (GroupSearcher)SearcherFactory.GetSearcher(GroupSearcher.CODE);
            PagingDataSet<GroupEntity> groups = groupSearcher.Search(query);

            //添加到用户搜索历史
            IUser CurrentUser = UserContext.CurrentUser;
            if (CurrentUser != null)
            {
                if (!string.IsNullOrWhiteSpace(query.Keyword))
                {
                    SearchHistoryService searchHistoryService = new SearchHistoryService();
                    searchHistoryService.SearchTerm(CurrentUser.UserId, GroupSearcher.CODE, query.Keyword);
                }
            }

            //添加到热词
            if (!string.IsNullOrWhiteSpace(query.Keyword))
            {
                SearchedTermService searchedTermService = new SearchedTermService();
                searchedTermService.SearchTerm(GroupSearcher.CODE, query.Keyword);
            }

            //设置页面Meta
            if (string.IsNullOrWhiteSpace(query.Keyword))
            {
                pageResourceManager.InsertTitlePart("群组搜索");//设置页面Title
            }
            else
            {
                pageResourceManager.InsertTitlePart('“' + query.Keyword + '”' + "的相关群组");//设置页面Title
            }

            return View(groups);
        }