private void MicroblogEntity_After(MicroblogEntity microblogEntity, CommonEventArgs commonEventArgs) { if (microblogEntity == null) { return; } if (microblogSearcher == null) { microblogSearcher = (MicroblogSearcher)SearcherFactory.GetSearcher(MicroblogSearcher.CODE); } //添加索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Create()) { microblogSearcher.Insert(microblogEntity); } //删除索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Delete()) { microblogSearcher.Delete(microblogEntity.MicroblogId); } //更新索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Update()) { microblogSearcher.Update(microblogEntity); } }
private void MicroblogEntity_After(MicroblogEntity microblogEntity, CommonEventArgs commonEventArgs) { if (microblogEntity == null) { return; } if (microblogSearcher == null) { microblogSearcher = (MicroblogSearcher)SearcherFactory.GetSearcher(MicroblogSearcher.CODE); } //添加索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Create()) { microblogSearcher.Insert(microblogEntity); } //删除索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Delete()) { microblogSearcher.Delete(microblogEntity.MicroblogId); } //更新索引 if (commonEventArgs.EventOperationType == EventOperationType.Instance().Update() || commonEventArgs.EventOperationType == EventOperationType.Instance().Approved() || commonEventArgs.EventOperationType == EventOperationType.Instance().Disapproved()) { microblogSearcher.Update(microblogEntity); } }