Example #1
0
        /// <summary>
        /// Synchronous backup method for console applications.
        /// </summary>
        public static void SynchronousBackupIndex()
        {
            using (var op = SnTrace.Repository.StartOperation("Backup index immediatelly."))
            {
                EnsureEmptyDirctory(_backupDirectoryPath);
                LuceneManager.PauseIndexing();

                while (!LuceneManager.Paused)
                {
                    Thread.Sleep(100);
                }
                Thread.Sleep(1000);
                try
                {
                    CopyIndexToBackupDirectory();
                }
                finally
                {
                    LuceneManager.ContinueIndexing();
                }

                OptimizeCompressAndStore();

                op.Successful = true;
            }
        }
 private static void ContinueIndexingAndWriteResult(HttpContext context)
 {
     try
     {
         LuceneManager.ContinueIndexing();
         context.Response.Write("OK");
     }
     catch (Exception ex)
     {
         Logger.WriteException(ex);
         context.Response.Write(ex.Message);
     }
 }