/// <summary> /// Ⱥ������������ /// </summary> /// <param name="spaceKey">Ⱥ����</param> /// <param name="keyword">�ؼ���</param> /// <param name="pageIndex">ҳ��</param> /// <returns>Ⱥ������������</returns> public ActionResult Search(string spaceKey, string keyword, BarSearchRange term = BarSearchRange.ALL, int pageIndex = 1) { long barSectionId = GroupIdToGroupKeyDictionary.GetGroupId(spaceKey); var group = groupService.Get(spaceKey); if (group == null) return HttpNotFound(); ViewData["group"] = group; BarSection section = barSectionService.Get(barSectionId); if (section == null) return HttpNotFound(); ViewData["section"] = section; BarFullTextQuery query = new BarFullTextQuery(); query.Term = term; query.PageIndex = pageIndex; query.PageSize = 20;//ÿҳ��¼�� query.Keyword = keyword; query.Range = section.SectionId.ToString(); //��ȡȺ�����ɵ����� query.TenantTypeId = TenantTypeIds.Instance().Group(); //��������id��ѯ�������� query.TenantTypeId = section.TenantTypeId; ViewData["barname"] = section.Name; ViewData["TenantTypeId"] = section.TenantTypeId; //������������������ BarSearcher BarSearcher = (BarSearcher)SearcherFactory.GetSearcher(BarSearcher.CODE); PagingDataSet<BarEntity> BarEntities = BarSearcher.Search(query); if (Request.IsAjaxRequest()) return View("~/Applications/Bar/Views/Bar/_ListSearchThread.cshtml", BarEntities); //����ҳ��Meta if (string.IsNullOrWhiteSpace(query.Keyword)) { pageResourceManager.InsertTitlePart("Ⱥ����������");//����ҳ��Title } else { pageResourceManager.InsertTitlePart('��' + query.Keyword + '��' + "���������");//����ҳ��Title } pageResourceManager.SetMetaOfKeywords("��������");//����Keyords���͵�Meta pageResourceManager.SetMetaOfDescription("��������");//����Description���͵�Meta return View(BarEntities); }
/// <summary> /// 群组内搜索帖子 /// </summary> /// <param name="spaceKey">群组名</param> /// <param name="keyword">关键字</param> /// <param name="pageIndex">页码</param> /// <returns>群组内搜索帖子</returns> public ActionResult Search(string spaceKey, string keyword, BarSearchRange term = BarSearchRange.ALL, int pageIndex = 1) { long barSectionId = GroupIdToGroupKeyDictionary.GetGroupId(spaceKey); var group = groupService.Get(spaceKey); if (group == null) { return(HttpNotFound()); } ViewData["group"] = group; BarSection section = barSectionService.Get(barSectionId); if (section == null) { return(HttpNotFound()); } ViewData["section"] = section; BarFullTextQuery query = new BarFullTextQuery(); query.Term = term; query.PageIndex = pageIndex; query.PageSize = 20;//每页记录数 query.Keyword = keyword; query.Range = section.SectionId.ToString(); //获取群组贴吧的帖子 query.TenantTypeId = TenantTypeIds.Instance().Group(); //根据帖吧id查询帖吧名字 query.TenantTypeId = section.TenantTypeId; ViewData["barname"] = section.Name; ViewData["TenantTypeId"] = section.TenantTypeId; //调用搜索器进行搜索 BarSearcher BarSearcher = (BarSearcher)SearcherFactory.GetSearcher(BarSearcher.CODE); PagingDataSet <BarEntity> BarEntities = BarSearcher.Search(query); if (Request.IsAjaxRequest()) { return(View("~/Applications/Bar/Views/Bar/_ListSearchThread.cshtml", BarEntities)); } //设置页面Meta if (string.IsNullOrWhiteSpace(query.Keyword)) { pageResourceManager.InsertTitlePart("群组帖子搜索");//设置页面Title } else { pageResourceManager.InsertTitlePart('“' + query.Keyword + '”' + "的相关帖子");//设置页面Title } pageResourceManager.SetMetaOfKeywords("帖吧搜索"); //设置Keyords类型的Meta pageResourceManager.SetMetaOfDescription("帖吧搜索"); //设置Description类型的Meta return(View(BarEntities)); }
/// <summary> /// 群组内搜索帖子 /// </summary> /// <param name="spaceKey">群组名</param> /// <param name="keyword">关键字</param> /// <param name="pageIndex">页码</param> /// <returns>群组内搜索帖子</returns> public ActionResult Search(string spaceKey, string keyword, BarSearchRange term = BarSearchRange.ALL, int pageIndex = 1) { long barSectionId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); var topic = topicService.Get(spaceKey); if (topic == null) return HttpNotFound(); ViewData["topic"] = topic; BarSection section = barSectionService.Get(barSectionId); if (section == null) return HttpNotFound(); ViewData["section"] = section; BarFullTextQuery query = new BarFullTextQuery(); query.Term = term; query.PageIndex = pageIndex; query.PageSize = 20;//每页记录数 query.Keyword = keyword; query.Range = section.SectionId.ToString(); //获取群组贴吧的帖子 query.TenantTypeId = TenantTypeIds.Instance().Topic(); //根据帖吧id查询帖吧名字 query.TenantTypeId = section.TenantTypeId; ViewData["barname"] = section.Name; ViewData["TenantTypeId"] = section.TenantTypeId; //调用搜索器进行搜索 BarSearcher BarSearcher = (BarSearcher)SearcherFactory.GetSearcher(BarSearcher.CODE); PagingDataSet<BarEntity> BarEntities = BarSearcher.Search(query); if (Request.IsAjaxRequest()) return View("~/Applications/Bar/Views/Bar/_ListSearchThread.cshtml", BarEntities); //设置页面Meta if (string.IsNullOrWhiteSpace(query.Keyword)) { pageResourceManager.InsertTitlePart("群组帖子搜索");//设置页面Title } else { pageResourceManager.InsertTitlePart('“' + query.Keyword + '”' + "的相关帖子");//设置页面Title } pageResourceManager.SetMetaOfKeywords("帖吧搜索");//设置Keyords类型的Meta pageResourceManager.SetMetaOfDescription("帖吧搜索");//设置Description类型的Meta return View(BarEntities); }