示例#1
0
 public void TearDown()
 {
     _cwsDir.Dispose();
     _pdfDir.Dispose();
     _simpleDir.Dispose();
     _conventionDir.Dispose();
     _searcher.Dispose();
 }
示例#2
0
        public void Dont_Initialize_Searchers_On_Dispose_If_Not_Already_Initialized()
        {
            var analyzer = new StandardAnalyzer(Version.LUCENE_30);

            using (var luceneDir1 = new RandomIdRAMDirectory())
                using (var luceneDir2 = new RandomIdRAMDirectory())
                    using (var luceneDir3 = new RandomIdRAMDirectory())
                        using (var luceneDir4 = new RandomIdRAMDirectory())
                            using (var indexer1 = new TestIndex(luceneDir1, analyzer))
                                using (var indexer2 = new TestIndex(luceneDir2, analyzer))
                                    using (var indexer3 = new TestIndex(luceneDir3, analyzer))
                                        using (var indexer4 = new TestIndex(luceneDir4, analyzer))
                                        {
                                            var searcher = new MultiIndexSearcher("testSearcher",
                                                                                  new[] { indexer1, indexer2, indexer3, indexer4 },
                                                                                  analyzer);

                                            Assert.IsFalse(searcher.SearchersInitialized);

                                            searcher.Dispose();

                                            Assert.IsFalse(searcher.SearchersInitialized);
                                        }
        }