Exemplo n.º 1
0
        public void ApplyToWriterConfig(IndexWriterConfig config)
        {
            try
            {
                // possibly take in a MergePolicy or configure it elsewhere
                var mergePolicy = new LogByteSizeMergePolicy();
                if (MergeFactor != null)
                {
                    mergePolicy.MergeFactor = (int)MergeFactor;
                }

                if (MaxMergeDocs != null)
                {
                    mergePolicy.MaxMergeDocs = (int)MaxMergeDocs;
                }

                config.MergePolicy = mergePolicy;

                if (MaxBufferedDocs != null)
                {
                    config.SetMaxBufferedDocs((int)MaxBufferedDocs);
                }

                if (RamBufferSizeMb != null)
                {
                    config.SetRAMBufferSizeMB((int)RamBufferSizeMb);
                }

                if (TermIndexInterval != null)
                {
                    config.SetTermIndexInterval((int)TermIndexInterval);
                }
            }
            catch (ArgumentOutOfRangeException)
            {
                // TODO: Log it
            }
        }