Пример #1
0
 public void UpdateIndex()
 {
     IStorageChangeCollection[] changes = Sync
                                          .Await(watchers.Values.Select(watcher => watcher.Update(index.Writer)));
     OnIndexChanged(new IndexChangesEventArgs(changes.ToDictionary(c => c.StorageArea)));
     index.Flush();
 }
 private static string ReadPayload(ExceptionLoggerContext context)
 {
     try
     {
         //TODO: use regular await.
         return(Sync.Await(context.Request.Content.ReadAsStringAsync()));
     }
     catch (Exception) {
         return(null);
     }
 }
Пример #3
0
        private void InitializeIndex()
        {
            //IndexWriter w = index.Storage.GetWriter(index.Analyzer);
            StorageIndexManagerInitializationProgressTracker initTracker = new StorageIndexManagerInitializationProgressTracker(watchers.Keys.Select(k => k));

            using (ILuceneWriteContext writer = index.Writer.WriteContext(buffer))
            {
                if (debugging)
                {
                    writer.InfoEvent += (sender, args) => logger.Log("indexdebug", Severity.Critical, args.Message, new { args });
                }

                Sync.Await(watchers.Values.Select(watcher => watcher
                                                  .Initialize(writer, new Progress <StorageIndexChangeLogWatcherInitializationProgress>(
                                                                  progress => tracker.SetProgress($"{initTracker.Capture(progress)}")))));
            }
            OnIndexInitialized(new IndexInitializedEventArgs());
        }