Пример #1
0
		private IndexWriter CreateWriterNoTry(Directory d, Analyzer a)
		{
			var indexExists = IndexExists();
			logger.Debug("Creating index writer, index exists: " + indexExists);
			var iw = new IndexWriter(d, a, create: !indexExists, mfl: IndexWriter.MaxFieldLength.UNLIMITED);
			iw.SetWriteLockTimeout(LockTimeout);
			return iw;
		}
Пример #2
0
 protected virtual IndexWriter CreateWriter(Directory d, Analyzer a)
 {
     var iw = new IndexWriter(d, a, create: !IndexExists(), mfl: IndexWriter.MaxFieldLength.UNLIMITED);
     iw.SetWriteLockTimeout(LockTimeout);
     return iw;
 }
Пример #3
0
 public virtual IndexWriter GetIndexWriter( string indexName )
 {
     IndexWriter writer;
     if ( !indexWriters.TryGetValue( indexName, out writer ) )
     {
         var index = GetIndex( indexName );
         var analyzer = GetIndexingAnalyzer( indexName );
         writer = new IndexWriter( index, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED );
         writer.SetRAMBufferSizeMB( configuration.MemoryBufferLimit );
         writer.SetWriteLockTimeout( configuration.WriterLockTimeout );
         writer.MaybeMerge();
         indexWriters.TryAdd( indexName, writer );
     }
     return writer;
 }