RestoreIndex() static private méthode

static private RestoreIndex ( bool force, System consoleOut ) : void
force bool
consoleOut System
Résultat void
Exemple #1
0
        internal static void ForceRestore()
        {
            try
            {
                PauseIndexing();
                ApplyChanges();
                BackupTools.RestoreIndex(true, null);

                var directory = FSDirectory.Open(new System.IO.DirectoryInfo(IndexDirectory.CurrentDirectory));
                //_writerRestartLock.EnterWriteLock();
                //try
                //{
                //    _writer = new IndexWriter(directory, IndexManager.GetAnalyzer(), false);
                //    _reader = _writer.GetReader();
                //}
                //finally
                //{
                //    _writerRestartLock.ExitWriteLock();
                //}
                using (var wrFrame = IndexWriterFrame.Get(true)) // // ForceRestore
                {
                    _writer = new IndexWriter(directory, IndexManager.GetAnalyzer(), false);
                    _reader = _writer.GetReader();
                }

                ExecuteUnprocessedIndexingActivities(null);
            }
            finally
            {
                ContinueIndexing();
            }
        }
Exemple #2
0
        private static void Startup(System.IO.TextWriter consoleOut)
        {
            try
            {
                //We can't handle cache invalidation as it would call into LuceneManager
                //we only process lucene messages
                var safeMessageTypes = new List <Type>();
                safeMessageTypes.Add(typeof(DistributedLuceneActivity.LuceneActivityDistributor));
                ClusterChannel.ProcessedMessageTypes = safeMessageTypes;

                //we positively start the message cluster
                int dummy  = SenseNet.ContentRepository.DistributedApplication.Cache.Count;
                var dummy2 = SenseNet.ContentRepository.DistributedApplication.ClusterChannel;

                if (SenseNet.ContentRepository.RepositoryInstance.RestoreIndexOnStartup())
                {
                    BackupTools.RestoreIndex(false, consoleOut);
                }

                CreateWriterAndReader();

                using (new SystemAccount())
                    ExecuteUnprocessedIndexingActivities(consoleOut);

                Warmup();

                var commitStart = new ThreadStart(CommitWorker);
                new Thread(commitStart).Start();
            }
            finally
            {
                ClusterChannel.ProcessedMessageTypes = null;
            }
        }
Exemple #3
0
        private static void Startup(System.IO.TextWriter consoleOut)
        {
            // we positively start the message cluster
            int dummy  = SenseNet.ContentRepository.DistributedApplication.Cache.Count;
            var dummy2 = SenseNet.ContentRepository.DistributedApplication.ClusterChannel;

            if (SenseNet.ContentRepository.RepositoryInstance.RestoreIndexOnStartup())
            {
                BackupTools.RestoreIndex(false, consoleOut);
            }

            CreateWriterAndReader();

            IndexingActivityQueue.Startup(consoleOut);

            Warmup();

            var commitStart = new ThreadStart(CommitWorker);
            var t           = new Thread(commitStart);

            t.Start();

            SnTrace.Index.Write("LM: 'CommitWorker' thread started. ManagedThreadId: {0}", t.ManagedThreadId);
        }