Example #1
0
		private IndexWriter InitIndex(MockRAMDirectory dir)
		{
			dir.SetLockFactory(NoLockFactory.Instance);

            IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED);
			//writer.setMaxBufferedDocs(2);
			writer.SetMaxBufferedDocs(10);
			((ConcurrentMergeScheduler) writer.MergeScheduler).SetSuppressExceptions();
			
			Document doc = new Document();
			doc.Add(new Field("content", "aaa", Field.Store.YES, Field.Index.ANALYZED));
			doc.Add(new Field("id", "0", Field.Store.YES, Field.Index.ANALYZED));
			for (int i = 0; i < 157; i++)
				writer.AddDocument(doc);
			
			return writer;
		}
Example #2
0
        private IndexWriter InitIndex(MockRAMDirectory dir)
        {
            dir.SetLockFactory(NoLockFactory.GetNoLockFactory());

            IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer());

            //writer.setMaxBufferedDocs(2);
            writer.SetMaxBufferedDocs(10);
            ((ConcurrentMergeScheduler)writer.GetMergeScheduler()).SetSuppressExceptions();

            Document doc = new Document();

            doc.Add(new Field("content", "aaa", Field.Store.YES, Field.Index.ANALYZED));
            doc.Add(new Field("id", "0", Field.Store.YES, Field.Index.ANALYZED));
            for (int i = 0; i < 157; i++)
            {
                writer.AddDocument(doc);
            }

            return(writer);
        }