public void IndexAsync(SbSearchDoc indexDoc, Action<bool> onComplete) { if (Storage == null) { try { var client = SbApp.Instance.Container.Resolve<IIndexingService>(); client.BeginWcfCall( c => c.Index(indexDoc), asyncCall => onComplete(asyncCall.End()), null); } catch (Castle.MicroKernel.ComponentNotFoundException) { Logger.Error("Storage not set; setup lucene storage or a remote storage!"); throw new Exception("Storage not set; setup lucene storage or a remote storage!"); } } else { Storage.Index(indexDoc); } }
public bool Index(SbSearchDoc indexDoc) { if (indexDoc == null) return true; if (Storage == null) { try { var client = SbApp.Instance.Container.Resolve<IIndexingService>(); client.BeginWcfCall(c => c.Index(indexDoc)).End(); } catch (Castle.MicroKernel.ComponentNotFoundException) { Logger.Error("Storage not set; setup lucene storage or a remote storage!"); throw new Exception("Storage not set; setup lucene storage or a remote storage!"); } } else { Storage.Index(indexDoc); } return true; }