BackupIndexImmediatelly() статический приватный Метод

static private BackupIndexImmediatelly ( ) : void
Результат void
Пример #1
0
        /*======================================================================================================= IIndexPopulator Members */

        // caller: IndexPopulator.Populator, Import.Importer, Tests.Initializer, RunOnce
        public void ClearAndPopulateAll(bool backup = true)
        {
            var lastActivityId = LuceneManager.GetLastStoredIndexingActivityId();
            var commitData     = CompletionState.GetCommitUserData(lastActivityId);

            using (var op = SnTrace.Index.StartOperation("IndexPopulator ClearAndPopulateAll"))
            {
                // recreate
                var writer = IndexManager.GetIndexWriter(true);
                try
                {
                    var excludedNodeTypes = LuceneManager.GetNotIndexedNodeTypes();
                    foreach (var docData in StorageContext.Search.LoadIndexDocumentsByPath("/Root", excludedNodeTypes))
                    {
                        var doc = IndexDocumentInfo.GetDocument(docData);
                        if (doc == null) // indexing disabled
                        {
                            continue;
                        }
                        writer.AddDocument(doc);
                        OnNodeIndexed(docData.Path);
                    }
                    RepositoryInstance.Instance.ConsoleWrite("  Commiting ... ");
                    writer.Commit(commitData);
                    RepositoryInstance.Instance.ConsoleWriteLine("ok");
                    RepositoryInstance.Instance.ConsoleWrite("  Optimizing ... ");
                    writer.Optimize();
                    RepositoryInstance.Instance.ConsoleWriteLine("ok");
                }
                finally
                {
                    writer.Close();
                }
                RepositoryInstance.Instance.ConsoleWrite("  Deleting indexing activities ... ");
                LuceneManager.DeleteAllIndexingActivities();
                RepositoryInstance.Instance.ConsoleWriteLine("ok");
                if (backup)
                {
                    RepositoryInstance.Instance.ConsoleWrite("  Making backup ... ");
                    BackupTools.BackupIndexImmediatelly();
                    RepositoryInstance.Instance.ConsoleWriteLine("ok");
                }
                op.Successful = true;
            }
        }
Пример #2
0
        /*======================================================================================================= IIndexPopulator Members */

        // caller: IndexPopulator.Populator, Import.Importer, Tests.Initializer, RunOnce
        public void ClearAndPopulateAll()
        {
            var lastActivityId = IndexingActivityManager.GetLastActivityId();
            var commitData     = IndexManager.CreateCommitUserData(lastActivityId);

            using (var traceOperation = Logger.TraceOperation("IndexPopulator ClearAndPopulateAll"))
            {
                //-- recreate
                var writer = IndexManager.GetIndexWriter(true);
                try
                {
                    foreach (var docData in StorageContext.Search.LoadIndexDocumentsByPath("/Root"))
                    {
                        var doc = IndexDocumentInfo.GetDocument(docData);
                        writer.AddDocument(doc);
                        OnNodeIndexed(docData.Path);
                    }
                    RepositoryInstance.Instance.ConsoleWrite("  Commiting ... ");
                    writer.Commit(commitData);
                    RepositoryInstance.Instance.ConsoleWriteLine("ok");
                    RepositoryInstance.Instance.ConsoleWrite("  Optimizing ... ");
                    writer.Optimize();
                    RepositoryInstance.Instance.ConsoleWriteLine("ok");
                }
                finally
                {
                    writer.Close();
                }
                RepositoryInstance.Instance.ConsoleWrite("  Deleting indexing activities ... ");
                IndexingActivityManager.DeleteAllActivities();
                RepositoryInstance.Instance.ConsoleWriteLine("ok");
                RepositoryInstance.Instance.ConsoleWrite("  Making backup ... ");
                BackupTools.BackupIndexImmediatelly();
                RepositoryInstance.Instance.ConsoleWriteLine("ok");
                traceOperation.IsSuccessful = true;
            }
        }
Пример #3
0
 public static void BackupAndShutDown()
 {
     ShutDown();
     BackupTools.BackupIndexImmediatelly();
 }