public void SaveOrUpdate(TDoc document) { Storage.SaveOrUpdate(document); FulltextBackgroundTaskExecutor.Schedule(() => { SearchEngine.Add(document); SearchEngine.CommitFulltextIndex(); }); }
public void SaveOrUpdate(params TDoc[] docs) { foreach (var doc in docs) { Storage.SaveOrUpdate(doc); } FulltextBackgroundTaskExecutor.Schedule(() => { SearchEngine.Add(docs); SearchEngine.CommitFulltextIndex(); }); }
public void Delete(params THeader[] docHeaders) { foreach (var docHeader in docHeaders) { var storageKey = EntityAdapter.GetStorageKey(docHeader); Log.DebugFormat("Deleting {0}#{1}", docHeader.Name, storageKey); Storage.Delete(storageKey); } FulltextBackgroundTaskExecutor.Schedule(() => { SearchEngine.Delete(docHeaders); SearchEngine.CommitFulltextIndex(); }); }
public TDoc Delete(TKey id) { var result = Storage.Delete(id); FulltextBackgroundTaskExecutor.Schedule(() => { if (EntityAdapter.CanConvertStorageKey) { SearchEngine.Delete(EntityAdapter.GetFulltextFromStorageKey(id)); } else if (result != null) { SearchEngine.Delete(EntityAdapter.GetFulltextKey(result)); } if (EntityAdapter.CanConvertStorageKey || result != null) { SearchEngine.CommitFulltextIndex(); } }); return(result); }