private void BarThread_After(BarThread barThread, CommonEventArgs commonEventArgs) { if (barThread == null) { return; } if (barSearcher == null) { barSearcher = (BarSearcher)SearcherFactory.GetSearcher(BarSearcher.CODE); } //添加索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Create()) { barSearcher.InsertBarThread(barThread); } //删除索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Delete()) { barSearcher.DeleteBarThread(barThread.ThreadId); } //更新索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Update() || commonEventArgs.EventOperationType == EventOperationType.Instance().Approved() || commonEventArgs.EventOperationType == EventOperationType.Instance().Disapproved()) { barSearcher.UpdateBarThread(barThread); } }
private void BarPost_After(BarPost barPost, CommonEventArgs commonEventArgs) { if (barPost == null) { return; } if (barSearcher == null) { barSearcher = (BarSearcher)SearcherFactory.GetSearcher(BarSearcher.CODE); } //添加索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Create()) { barSearcher.InsertBarPost(barPost); } //删除索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Delete()) { barSearcher.DeleteBarPost(barPost.PostId); } //更新索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Update()) { barSearcher.UpdateBarPost(barPost); } }
private void BarPost_After(BarPost barPost, CommonEventArgs commonEventArgs) { if (barPost == null) { return; } if (barSearcher == null) { barSearcher = (BarSearcher)SearcherFactory.GetSearcher(BarSearcher.CODE); } //添加索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Create()) { barSearcher.InsertBarPost(barPost); } //删除索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Delete()) { barSearcher.DeleteBarPost(barPost.PostId); } //更新索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Update()) { barSearcher.UpdateBarPost(barPost); } }
private void DeleteItemInTags(ItemInTag sender, CommonEventArgs eventArgs) { if (sender.TenantTypeId == TenantTypeIds.Instance().BarThread()) { long barThreadId = sender.ItemId; if (barSearcher == null) { barSearcher = (BarSearcher)SearcherFactory.GetSearcher(BarSearcher.CODE); } barSearcher.UpdateBarThread(barThreadService.Get(barThreadId)); } }
/// <summary> /// 为日志添加标签时触发 /// </summary> private void AddTagsToBar_BatchAfter(IEnumerable <string> senders, TagEventArgs eventArgs) { if (eventArgs.TenantTypeId == TenantTypeIds.Instance().BarThread()) { long barThreadId = eventArgs.ItemId; if (barSearcher == null) { barSearcher = (BarSearcher)SearcherFactory.GetSearcher(BarSearcher.CODE); } barSearcher.UpdateBarThread(barThreadService.Get(barThreadId)); } }
/// <summary> /// 为日志添加标签时触发 /// </summary> private void AddTagsToBar_BatchAfter(IEnumerable<string> senders, TagEventArgs eventArgs) { if (eventArgs.TenantTypeId == TenantTypeIds.Instance().BarThread()) { long barThreadId = eventArgs.ItemId; if (barSearcher == null) { barSearcher = (BarSearcher)SearcherFactory.GetSearcher(BarSearcher.CODE); } barSearcher.UpdateBarThread(barThreadService.Get(barThreadId)); } }
/// <summary> /// 删除和更新标签时触发 /// </summary> private void DeleteUpdateTags_Before(Tag sender, CommonEventArgs eventArgs) { if (sender.TenantTypeId == TenantTypeIds.Instance().BarThread()) { if (eventArgs.EventOperationType == EventOperationType.Instance().Delete() || eventArgs.EventOperationType == EventOperationType.Instance().Update()) { //根据标签获取所有使用该标签的(内容项)用户 IEnumerable <long> barThreadIds = tagService.GetItemIds(sender.TagName, null); if (barSearcher == null) { barSearcher = (BarSearcher)SearcherFactory.GetSearcher(BarSearcher.CODE); } barSearcher.UpdateBarThread(barThreadService.GetBarThreads(barThreadIds)); } } }
/// <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> private void DeleteUpdateTags_Before(Tag sender, CommonEventArgs eventArgs) { if (sender.TenantTypeId == TenantTypeIds.Instance().BarThread()) { if (eventArgs.EventOperationType == EventOperationType.Instance().Delete() || eventArgs.EventOperationType == EventOperationType.Instance().Update()) { //根据标签获取所有使用该标签的(内容项)用户 IEnumerable<long> barThreadIds = tagService.GetItemIds(sender.TagName, null); if (barSearcher == null) { barSearcher = (BarSearcher)SearcherFactory.GetSearcher(BarSearcher.CODE); } barSearcher.UpdateBarThread(barThreadService.GetBarThreads(barThreadIds)); } } }
private void DeleteItemInTags(ItemInTag sender, CommonEventArgs eventArgs) { if (sender.TenantTypeId == TenantTypeIds.Instance().BarThread()) { long barThreadId = sender.ItemId; if (barSearcher == null) { barSearcher = (BarSearcher)SearcherFactory.GetSearcher(BarSearcher.CODE); } barSearcher.UpdateBarThread(barThreadService.Get(barThreadId)); } }
private void BarThread_After(BarThread barThread, CommonEventArgs commonEventArgs) { if (barThread == null) { return; } if (barSearcher == null) { barSearcher = (BarSearcher)SearcherFactory.GetSearcher(BarSearcher.CODE); } //添加索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Create()) { barSearcher.InsertBarThread(barThread); } //删除索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Delete()) { barSearcher.DeleteBarThread(barThread.ThreadId); } //更新索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Update() || commonEventArgs.EventOperationType == EventOperationType.Instance().Approved() || commonEventArgs.EventOperationType == EventOperationType.Instance().Disapproved()) { barSearcher.UpdateBarThread(barThread); } }