コード例 #1
0
 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);
     }
 }
コード例 #2
0
        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;
        }