示例#1
0
        private void CreateIndexWriter(IState state)
        {
            _indexWriter = new TimeTrackingIndexWriter(_directory, _analyzer, _indexDeletionPolicy, _maxFieldLength, state);
            _indexWriter.UseCompoundFile = false;
            _indexWriter.SetMergePolicy(new LogByteSizeMergePolicy(_indexWriter)
            {
                MaxMergeMB         = _index.Configuration.MaximumSizePerSegment.GetValue(SizeUnit.Megabytes),
                MergeFactor        = _index.Configuration.MergeFactor,
                LargeSegmentSizeMB = _index.Configuration.LargeSegmentSizeToMerge.GetValue(SizeUnit.Megabytes),
                NumberOfLargeSegmentsToMergeInSingleBatch = _index.Configuration.NumberOfLargeSegmentsToMergeInSingleBatch
            });

            if (_indexReaderWarmer != null)
            {
                _indexWriter.MergedSegmentWarmer = _indexReaderWarmer;
            }

            var scheduler = new TimeTrackingSerialMergeScheduler(_index);

            _indexWriter.InitializeMergeScheduler(scheduler, state);

            // RavenDB already manages the memory for those, no need for Lucene to do this as well
            _indexWriter.SetMaxBufferedDocs(IndexWriter.DISABLE_AUTO_FLUSH);
            _indexWriter.SetRAMBufferSizeMB(1024);
        }
示例#2
0
 public void InitializeMergeScheduler(TimeTrackingSerialMergeScheduler scheduler, IState state)
 {
     _mergeScheduler = scheduler;
     SetMergeScheduler(_mergeScheduler, state);
 }