public void PurgeAll()
        {
            using (ISession s = OpenSession())
            {
                SearchFactoryImpl  searchFactory = SearchFactoryImpl.GetSearchFactory(cfg);
                System.Type        targetType    = typeof(Document);
                IDirectoryProvider provider      = searchFactory.GetDirectoryProviders(targetType)[0];
                Workspace          workspace     = new Workspace(searchFactory);

                using (ITransaction tx = s.BeginTransaction())
                {
                    Document doc = new Document("Hibernate in Action", "Object and Relational", "blah blah blah");
                    searchFactory.PerformWork(doc, 1, s, WorkType.Add);
                    doc = new Document("Object and Relational", "Hibernate in Action", "blah blah blah");
                    searchFactory.PerformWork(doc, 2, s, WorkType.Add);
                    tx.Commit();
                }
                Assert.AreEqual(2, workspace.GetIndexReader(provider, targetType).NumDocs, "Documents created");

                using (ITransaction tx = s.BeginTransaction())
                {
                    LuceneWorker luceneWorker = new LuceneWorker(workspace);
                    luceneWorker.PerformWork(new PurgeAllLuceneWork(targetType), provider);
                }
                Assert.AreEqual(0, workspace.GetIndexReader(provider, targetType).NumDocs, "Document purgation");
            }
        }
        public void TransactionParameters()
        {
            IFullTextSession         fullTextSession    = Search.CreateFullTextSession(OpenSession());
            SearchFactoryImpl        searchFactory      = (SearchFactoryImpl)fullTextSession.SearchFactory;
            LuceneIndexingParameters indexingParameters = searchFactory.GetIndexingParameters(searchFactory.GetDirectoryProviders(typeof(Query.Book))[0]);

            Assert.AreEqual(4, (int)indexingParameters.TransactionIndexParameters.RamBufferSizeMb);
            Assert.AreEqual(15, (int)indexingParameters.TransactionIndexParameters.MaxMergeDocs);
            Assert.AreEqual(17, (int)indexingParameters.TransactionIndexParameters.MaxBufferedDocs);
            Assert.AreEqual(16, (int)indexingParameters.TransactionIndexParameters.MergeFactor);
            Assert.AreEqual(101, (int)indexingParameters.TransactionIndexParameters.TermIndexInterval);
            fullTextSession.Close();
        }
        public void BatchParametersDefault()
        {
            IFullTextSession         fullTextSession    = Search.CreateFullTextSession(OpenSession());
            SearchFactoryImpl        searchFactory      = (SearchFactoryImpl)fullTextSession.SearchFactory;
            LuceneIndexingParameters indexingParameters = searchFactory.GetIndexingParameters(searchFactory.GetDirectoryProviders(typeof(Query.Author))[0]);

            Assert.AreEqual(1, (int)indexingParameters.BatchIndexParameters.RamBufferSizeMb);
            Assert.AreEqual(9, (int)indexingParameters.BatchIndexParameters.MaxMergeDocs);
            Assert.AreEqual(1000, (int)indexingParameters.BatchIndexParameters.MaxBufferedDocs);
            Assert.AreEqual(10, (int)indexingParameters.BatchIndexParameters.MergeFactor);
            fullTextSession.Close();
        }
        public void UnsetBatchValueTakesTransaction()
        {
            IFullTextSession         fullTextSession    = Search.CreateFullTextSession(OpenSession());
            SearchFactoryImpl        searchFactory      = (SearchFactoryImpl)fullTextSession.SearchFactory;
            LuceneIndexingParameters indexingParameters = searchFactory.GetIndexingParameters(searchFactory.GetDirectoryProviders(typeof(DocumentTop))[0]);

            Assert.AreEqual(10, (int)indexingParameters.BatchIndexParameters.MergeFactor);
            Assert.AreEqual(1000, (int)indexingParameters.BatchIndexParameters.MaxBufferedDocs);
            Assert.AreEqual(99, (int)indexingParameters.BatchIndexParameters.TermIndexInterval);
            fullTextSession.Close();
        }