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; }
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; }
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; }