/// <summary>
 /// Creates a new config that that handles the live <see cref="IndexWriter"/>
 /// settings.
 /// </summary>
 internal LiveIndexWriterConfig(IndexWriterConfig config)
 {
     maxBufferedDeleteTerms  = config.MaxBufferedDeleteTerms;
     maxBufferedDocs         = config.MaxBufferedDocs;
     mergedSegmentWarmer     = config.MergedSegmentWarmer;
     ramBufferSizeMB         = config.RAMBufferSizeMB;
     readerTermsIndexDivisor = config.ReaderTermsIndexDivisor;
     termIndexInterval       = config.TermIndexInterval;
     matchVersion            = config.matchVersion;
     analyzer              = config.Analyzer;
     delPolicy             = config.IndexDeletionPolicy;
     commit                = config.IndexCommit;
     openMode              = config.OpenMode;
     similarity            = config.Similarity;
     mergeScheduler        = config.MergeScheduler;
     writeLockTimeout      = config.WriteLockTimeout;
     indexingChain         = config.IndexingChain;
     codec                 = config.Codec;
     infoStream            = config.InfoStream;
     mergePolicy           = config.MergePolicy;
     indexerThreadPool     = config.IndexerThreadPool;
     readerPooling         = config.UseReaderPooling;
     flushPolicy           = config.FlushPolicy;
     perThreadHardLimitMB  = config.RAMPerThreadHardLimitMB;
     useCompoundFile       = config.UseCompoundFile;
     checkIntegrityAtMerge = config.CheckIntegrityAtMerge;
 }
        // used by IndexWriterConfig
        internal LiveIndexWriterConfig(Analyzer analyzer, LuceneVersion matchVersion)
        {
            this.analyzer           = analyzer;
            this.matchVersion       = matchVersion;
            ramBufferSizeMB         = IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB;
            maxBufferedDocs         = IndexWriterConfig.DEFAULT_MAX_BUFFERED_DOCS;
            maxBufferedDeleteTerms  = IndexWriterConfig.DEFAULT_MAX_BUFFERED_DELETE_TERMS;
            readerTermsIndexDivisor = IndexWriterConfig.DEFAULT_READER_TERMS_INDEX_DIVISOR;
            mergedSegmentWarmer     = null;
            termIndexInterval       = IndexWriterConfig.DEFAULT_TERM_INDEX_INTERVAL; // TODO: this should be private to the codec, not settable here
            delPolicy       = new KeepOnlyLastCommitDeletionPolicy();
            commit          = null;
            useCompoundFile = IndexWriterConfig.DEFAULT_USE_COMPOUND_FILE_SYSTEM;
            openMode        = Index.OpenMode.CREATE_OR_APPEND;
            similarity      = IndexSearcher.DefaultSimilarity;
#if !FEATURE_CONCURRENTMERGESCHEDULER
            mergeScheduler = new TaskMergeScheduler();
#else
            mergeScheduler = new ConcurrentMergeScheduler();
#endif
            writeLockTimeout = IndexWriterConfig.WRITE_LOCK_TIMEOUT;
            indexingChain    = DocumentsWriterPerThread.DefaultIndexingChain;
            codec            = Codec.Default;
            if (codec == null)
            {
                throw new System.NullReferenceException();
            }
            infoStream           = Util.InfoStream.Default;
            mergePolicy          = new TieredMergePolicy();
            flushPolicy          = new FlushByRamOrCountsPolicy();
            readerPooling        = IndexWriterConfig.DEFAULT_READER_POOLING;
            indexerThreadPool    = new ThreadAffinityDocumentsWriterThreadPool(IndexWriterConfig.DEFAULT_MAX_THREAD_STATES);
            perThreadHardLimitMB = IndexWriterConfig.DEFAULT_RAM_PER_THREAD_HARD_LIMIT_MB;
        }
Пример #3
0
 internal DocumentsWriter(IndexWriter writer, LiveIndexWriterConfig config, Directory directory)
 {
     this.directory     = directory;
     this.config        = config;
     this.infoStream    = config.InfoStream;
     this.perThreadPool = config.IndexerThreadPool;
     flushPolicy        = config.FlushPolicy;
     this.writer        = writer;
     this.events        = new ConcurrentQueue <IEvent>();
     flushControl       = new DocumentsWriterFlushControl(this, config, writer.bufferedUpdatesStream);
 }
Пример #4
0
 internal DocumentsWriterFlushControl(DocumentsWriter documentsWriter, LiveIndexWriterConfig config, BufferedUpdatesStream bufferedUpdatesStream)
 {
     this.infoStream            = config.InfoStream;
     this.stallControl          = new DocumentsWriterStallControl();
     this.perThreadPool         = documentsWriter.perThreadPool;
     this.flushPolicy           = documentsWriter.flushPolicy;
     this.config                = config;
     this.hardMaxBytesPerDWPT   = config.RAMPerThreadHardLimitMB * 1024 * 1024;
     this.documentsWriter       = documentsWriter;
     this.bufferedUpdatesStream = bufferedUpdatesStream;
 }