示例#1
0
        public void RecreatingWriterDoesNotRefreshIndex()
        {
            LeoTrace.WriteLine = Console.WriteLine;

            _indexer.WriteToIndex(CreateIpsumDocs(3), true).Wait();
            _indexer.Dispose();
            _indexer = new LuceneIndex(new SecureStore(_store), "testindexer", "basePath", null);
            _indexer.WriteToIndex(CreateIpsumDocs(3), true).Wait();
            _indexer.Dispose();
            _indexer = new LuceneIndex(new SecureStore(_store), "testindexer", "basePath", null);

            var number = _indexer.SearchDocuments(s => s.Search(new MatchAllDocsQuery(), int.MaxValue)).Count();

            Assert.AreEqual(6, number);
        }
示例#2
0
        protected virtual void Dispose(bool disposing)
        {
            Logging.Debug("LibraryIndex::Dispose({0}) @{1}", disposing, dispose_count);

            WPFDoEvents.SafeExec(() =>
            {
                if (dispose_count == 0)
                {
                    // Get rid of managed resources
                    // Utilities.LockPerfTimer l1_clk = Utilities.LockPerfChecker.Start();
                    lock (word_index_manager_lock)
                    {
                        // l1_clk.LockPerfTimerStop();

                        word_index_manager?.Dispose();
                        word_index_manager = null;
                    }

                    //this.library?.Dispose();
                }
            });

            WPFDoEvents.SafeExec(() =>
            {
                //this.word_index_manager = null;
                library = null;
            });

            WPFDoEvents.SafeExec(() =>
            {
                //Utilities.LockPerfTimer l4_clk = Utilities.LockPerfChecker.Start();
                lock (pdf_documents_in_library_lock)
                {
                    //l4_clk.LockPerfTimerStop();

                    pdf_documents_in_library?.Clear();
                    pdf_documents_in_library = null;
                }
            });

            ++dispose_count;
        }
示例#3
0
        protected virtual void Dispose(bool disposing)
        {
            Logging.Debug("LibraryIndex::Dispose({0}) @{1}", disposing, dispose_count);

            try
            {
                if (dispose_count == 0)
                {
                    // Get rid of managed resources
                    Utilities.LockPerfTimer l1_clk = Utilities.LockPerfChecker.Start();
                    lock (word_index_manager_lock)
                    {
                        l1_clk.LockPerfTimerStop();

                        word_index_manager?.Dispose();
                        word_index_manager = null;
                    }

                    //this.library?.Dispose();
                }

                //this.word_index_manager = null;
                library = null;

                Utilities.LockPerfTimer l4_clk = Utilities.LockPerfChecker.Start();
                lock (pdf_documents_in_library_lock)
                {
                    l4_clk.LockPerfTimerStop();

                    pdf_documents_in_library?.Clear();
                    pdf_documents_in_library = null;
                }
            }
            catch (Exception ex)
            {
                Logging.Error(ex);
            }

            ++dispose_count;
        }
示例#4
0
        public void RecreatingWriterDoesNotRefreshIndex()
        {
            LeoTrace.WriteLine = Console.WriteLine;

            _indexer.WriteToIndex(CreateIpsumDocs(3), true).Wait();
            _indexer.Dispose();
            _indexer = new LuceneIndex(new SecureStore(_store), "testindexer", "basePath", null);
            _indexer.WriteToIndex(CreateIpsumDocs(3), true).Wait();
            _indexer.Dispose();
            _indexer = new LuceneIndex(new SecureStore(_store), "testindexer", "basePath", null);

            var number = _indexer.SearchDocuments(s => s.Search(new MatchAllDocsQuery(), int.MaxValue)).Count();
            Assert.AreEqual(6, number);
        }
示例#5
0
 public void TearDown()
 {
     _indexer.Dispose();
     _store.PermanentDeleteContainer("testindexer").Wait();
 }