-
Notifications
You must be signed in to change notification settings - Fork 624
/
IndexWriterConfig.cs
620 lines (559 loc) · 26.1 KB
/
IndexWriterConfig.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
using Lucene.Net.Util;
using System;
using System.IO;
using System.Text;
namespace Lucene.Net.Index
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using Analyzer = Lucene.Net.Analysis.Analyzer;
using Codec = Lucene.Net.Codecs.Codec;
using IndexingChain = Lucene.Net.Index.DocumentsWriterPerThread.IndexingChain;
using IndexReaderWarmer = Lucene.Net.Index.IndexWriter.IndexReaderWarmer;
using InfoStream = Lucene.Net.Util.InfoStream;
using TextWriterInfoStream = Lucene.Net.Util.TextWriterInfoStream;
using Similarity = Lucene.Net.Search.Similarities.Similarity;
/// <summary>
/// Holds all the configuration that is used to create an <see cref="IndexWriter"/>.
/// Once <see cref="IndexWriter"/> has been created with this object, changes to this
/// object will not affect the <see cref="IndexWriter"/> instance. For that, use
/// <see cref="LiveIndexWriterConfig"/> that is returned from <see cref="IndexWriter.Config"/>.
///
/// <para/>
/// LUCENENET NOTE: Unlike Lucene, we use property setters instead of setter methods.
/// In C#, this allows you to initialize the <see cref="IndexWriterConfig"/>
/// using the language features of C#, for example:
/// <code>
/// IndexWriterConfig conf = new IndexWriterConfig(analyzer)
/// {
/// Codec = Lucene46Codec(),
/// OpenMode = OpenMode.CREATE
/// };
/// </code>
///
/// However, if you prefer to match the syntax of Lucene using chained setter methods,
/// there are extension methods in the Lucene.Net.Index.Extensions namespace. Example usage:
/// <code>
/// using Lucene.Net.Index.Extensions;
///
/// ..
///
/// IndexWriterConfig conf = new IndexWriterConfig(analyzer)
/// .SetCodec(new Lucene46Codec())
/// .SetOpenMode(OpenMode.CREATE);
/// </code>
///
/// @since 3.1
/// </summary>
/// <seealso cref="IndexWriter.Config"/>
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public sealed class IndexWriterConfig : LiveIndexWriterConfig // LUCENENET specific: Not implementing ICloneable per Microsoft's recommendation
{
// LUCENENET specific: De-nested OpenMode enum from this class to prevent naming conflict
/// <summary>
/// Default value is 32. Change using <see cref="LiveIndexWriterConfig.TermIndexInterval"/> setter. </summary>
public static readonly int DEFAULT_TERM_INDEX_INTERVAL = 32; // TODO: this should be private to the codec, not settable here
/// <summary>
/// Denotes a flush trigger is disabled. </summary>
public static readonly int DISABLE_AUTO_FLUSH = -1;
/// <summary>
/// Disabled by default (because IndexWriter flushes by RAM usage by default). </summary>
public static readonly int DEFAULT_MAX_BUFFERED_DELETE_TERMS = DISABLE_AUTO_FLUSH;
/// <summary>
/// Disabled by default (because IndexWriter flushes by RAM usage by default). </summary>
public static readonly int DEFAULT_MAX_BUFFERED_DOCS = DISABLE_AUTO_FLUSH;
/// <summary>
/// Default value is 16 MB (which means flush when buffered docs consume
/// approximately 16 MB RAM).
/// </summary>
public static readonly double DEFAULT_RAM_BUFFER_SIZE_MB = 16.0;
/// <summary>
/// Default value for the write lock timeout (1,000 ms).
/// </summary>
/// <see cref="DefaultWriteLockTimeout"/>
public static long WRITE_LOCK_TIMEOUT = 1000;
/// <summary>
/// Default setting for <see cref="UseReaderPooling"/>. </summary>
public static readonly bool DEFAULT_READER_POOLING = false;
/// <summary>
/// Default value is 1. Change using <see cref="LiveIndexWriterConfig.ReaderTermsIndexDivisor"/> setter. </summary>
public static readonly int DEFAULT_READER_TERMS_INDEX_DIVISOR = DirectoryReader.DEFAULT_TERMS_INDEX_DIVISOR;
/// <summary>
/// Default value is 1945. Change using <see cref="RAMPerThreadHardLimitMB"/> setter. </summary>
public static readonly int DEFAULT_RAM_PER_THREAD_HARD_LIMIT_MB = 1945;
/// <summary>
/// The maximum number of simultaneous threads that may be
/// indexing documents at once in <see cref="IndexWriter"/>; if more
/// than this many threads arrive they will wait for
/// others to finish. Default value is 8.
/// </summary>
public static readonly int DEFAULT_MAX_THREAD_STATES = 8;
/// <summary>
/// Default value for compound file system for newly written segments
/// (set to <c>true</c>). For batch indexing with very large
/// ram buffers use <c>false</c>
/// </summary>
public static readonly bool DEFAULT_USE_COMPOUND_FILE_SYSTEM = true;
/// <summary>
/// Default value for calling <see cref="AtomicReader.CheckIntegrity()"/> before
/// merging segments (set to <c>false</c>). You can set this
/// to <c>true</c> for additional safety.
/// </summary>
public static readonly bool DEFAULT_CHECK_INTEGRITY_AT_MERGE = false;
/// <summary>
/// Gets or sets the default (for any instance) maximum time to wait for a write lock
/// (in milliseconds).
/// </summary>
public static long DefaultWriteLockTimeout
{
get => WRITE_LOCK_TIMEOUT;
set => WRITE_LOCK_TIMEOUT = value;
}
// indicates whether this config instance is already attached to a writer.
// not final so that it can be cloned properly.
private SetOnce<IndexWriter> writer = new SetOnce<IndexWriter>();
/// <summary>
/// Gets or sets the <see cref="IndexWriter"/> this config is attached to.
/// </summary>
/// <exception cref="Util.AlreadySetException">
/// if this config is already attached to a writer. </exception>
internal IndexWriterConfig SetIndexWriter(IndexWriter writer)
{
this.writer.Set(writer);
return this;
}
/// <summary>
/// Creates a new config that with defaults that match the specified
/// <see cref="LuceneVersion"/> as well as the default
/// <see cref="Analyzer"/>. If <paramref name="matchVersion"/> is >=
/// <see cref="LuceneVersion.LUCENE_32"/>, <see cref="TieredMergePolicy"/> is used
/// for merging; else <see cref="LogByteSizeMergePolicy"/>.
/// Note that <see cref="TieredMergePolicy"/> is free to select
/// non-contiguous merges, which means docIDs may not
/// remain monotonic over time. If this is a problem you
/// should switch to <see cref="LogByteSizeMergePolicy"/> or
/// <see cref="LogDocMergePolicy"/>.
/// </summary>
public IndexWriterConfig(LuceneVersion matchVersion, Analyzer analyzer)
: base(analyzer, matchVersion)
{
}
public object Clone()
{
IndexWriterConfig clone = (IndexWriterConfig)this.MemberwiseClone();
clone.writer = (SetOnce<IndexWriter>)writer.Clone();
// Mostly shallow clone, but do a deepish clone of
// certain objects that have state that cannot be shared
// across IW instances:
clone.delPolicy = (IndexDeletionPolicy)delPolicy.Clone();
clone.flushPolicy = (FlushPolicy)flushPolicy.Clone();
clone.indexerThreadPool = (DocumentsWriterPerThreadPool)indexerThreadPool.Clone();
// we clone the infoStream because some impls might have state variables
// such as line numbers, message throughput, ...
clone.infoStream = (InfoStream)infoStream.Clone();
clone.mergePolicy = (MergePolicy)mergePolicy.Clone();
clone.mergeScheduler = (IMergeScheduler)mergeScheduler.Clone();
return clone;
// LUCENENET specific - no need to deal with checked exceptions here
}
/// <summary>
/// Specifies <see cref="Index.OpenMode"/> of the index.
///
/// <para/>Only takes effect when <see cref="IndexWriter"/> is first created.
/// </summary>
// LUCENENET NOTE: We cannot override a getter and add a setter,
// so must declare it new. See: http://stackoverflow.com/q/82437
new public OpenMode OpenMode
{
get => openMode;
set =>
// LUCENENET specific - making non-nullable, so we don't need to worry about this.
//if (value == null)
//{
// throw new ArgumentException("openMode must not be null");
//}
this.openMode = value;
}
/// <summary>
/// Expert: allows an optional <see cref="Index.IndexDeletionPolicy"/> implementation to be
/// specified. You can use this to control when prior commits are deleted from
/// the index. The default policy is <see cref="KeepOnlyLastCommitDeletionPolicy"/>
/// which removes all prior commits as soon as a new commit is done (this
/// matches behavior before 2.2). Creating your own policy can allow you to
/// explicitly keep previous "point in time" commits alive in the index for
/// some time, to allow readers to refresh to the new commit without having the
/// old commit deleted out from under them. This is necessary on filesystems
/// like NFS that do not support "delete on last close" semantics, which
/// Lucene's "point in time" search normally relies on.
/// <para/>
/// <b>NOTE:</b> the deletion policy cannot be <c>null</c>.
///
/// <para/>Only takes effect when IndexWriter is first created.
/// </summary>
// LUCENENET NOTE: We cannot override a getter and add a setter,
// so must declare it new. See: http://stackoverflow.com/q/82437
new public IndexDeletionPolicy IndexDeletionPolicy
{
get => delPolicy;
set => delPolicy = value ?? throw new ArgumentNullException(nameof(value), "IndexDeletionPolicy must not be null");
}
/// <summary>
/// Expert: allows to open a certain commit point. The default is <c>null</c> which
/// opens the latest commit point.
///
/// <para/>Only takes effect when <see cref="IndexWriter"/> is first created.
/// </summary>
// LUCENENET NOTE: We cannot override a getter and add a setter,
// so must declare it new. See: http://stackoverflow.com/q/82437
new public IndexCommit IndexCommit
{
get => commit;
set => this.commit = value;
}
/// <summary>
/// Expert: set the <see cref="Search.Similarities.Similarity"/> implementation used by this <see cref="IndexWriter"/>.
/// <para/>
/// <b>NOTE:</b> the similarity cannot be <c>null</c>.
///
/// <para/>Only takes effect when <see cref="IndexWriter"/> is first created.
/// </summary>
// LUCENENET NOTE: We cannot override a getter and add a setter,
// so must declare it new. See: http://stackoverflow.com/q/82437
new public Similarity Similarity
{
get => similarity;
set => similarity = value ?? throw new ArgumentNullException(nameof(value), "Similarity must not be null");
}
/// <summary>
/// Expert: Gets or sets the merge scheduler used by this writer. The default is
/// <see cref="ConcurrentMergeScheduler"/>.
/// <para/>
/// <b>NOTE:</b> the merge scheduler cannot be <c>null</c>.
///
/// <para/>Only takes effect when <see cref="IndexWriter"/> is first created.
/// </summary>
// LUCENENET NOTE: We cannot override a getter and add a setter,
// so must declare it new. See: http://stackoverflow.com/q/82437
new public IMergeScheduler MergeScheduler
{
get => mergeScheduler;
set => mergeScheduler = value ?? throw new ArgumentNullException(nameof(value), "MergeScheduler must not be null");
}
/// <summary>
/// Gets or sets the maximum time to wait for a write lock (in milliseconds) for this
/// instance. You can change the default value for all instances by calling the
/// <see cref="DefaultWriteLockTimeout"/> setter.
///
/// <para/>Only takes effect when <see cref="IndexWriter"/> is first created.
/// </summary>
// LUCENENET NOTE: We cannot override a getter and add a setter,
// so must declare it new. See: http://stackoverflow.com/q/82437
new public long WriteLockTimeout
{
get => writeLockTimeout;
set => this.writeLockTimeout = value;
}
/// <summary>
/// Gets or sets the <see cref="Codecs.Codec"/>.
/// <para/>
/// Only takes effect when <see cref="IndexWriter"/> is first created.
/// </summary>
// LUCENENET NOTE: We cannot override a getter and add a setter,
// so must declare it new. See: http://stackoverflow.com/q/82437
new public Codec Codec
{
get => codec;
set => codec = value ?? throw new ArgumentException(nameof(value), "Codec must not be null");
}
/// <summary>
/// Expert: <see cref="Index.MergePolicy"/> is invoked whenever there are changes to the
/// segments in the index. Its role is to select which merges to do, if any,
/// and return a <see cref="MergePolicy.MergeSpecification"/> describing the merges.
/// It also selects merges to do for <see cref="IndexWriter.ForceMerge(int)"/>.
///
/// <para/>Only takes effect when <see cref="IndexWriter"/> is first created.
/// </summary>
// LUCENENET NOTE: We cannot override a getter and add a setter,
// so must declare it new. See: http://stackoverflow.com/q/82437
new public MergePolicy MergePolicy
{
get => mergePolicy;
set => mergePolicy = value ?? throw new ArgumentNullException(nameof(value), "MergePolicy must not be null");
}
/// <summary>
/// Expert: Gets or sets the <see cref="DocumentsWriterPerThreadPool"/> instance used by the
/// <see cref="IndexWriter"/> to assign thread-states to incoming indexing threads. If no
/// <see cref="DocumentsWriterPerThreadPool"/> is set <see cref="IndexWriter"/> will use
/// <see cref="DocumentsWriterPerThreadPool"/> with max number of
/// thread-states set to <see cref="DEFAULT_MAX_THREAD_STATES"/> (see
/// <see cref="DEFAULT_MAX_THREAD_STATES"/>).
/// <para>
/// NOTE: The given <see cref="DocumentsWriterPerThreadPool"/> instance must not be used with
/// other <see cref="IndexWriter"/> instances once it has been initialized / associated with an
/// <see cref="IndexWriter"/>.
/// </para>
/// <para>
/// NOTE: this only takes effect when <see cref="IndexWriter"/> is first created.</para>
/// </summary>
// LUCENENET NOTE: We cannot override a getter and add a setter,
// so must declare it new. See: http://stackoverflow.com/q/82437
new internal DocumentsWriterPerThreadPool IndexerThreadPool
{
get => indexerThreadPool;
set => indexerThreadPool = value ?? throw new ArgumentNullException(nameof(value), "IndexerThreadPool must not be null");
}
/// <summary>
/// Gets or sets the max number of simultaneous threads that may be indexing documents
/// at once in <see cref="IndexWriter"/>. Values < 1 are invalid and if passed
/// <c>maxThreadStates</c> will be set to
/// <see cref="DEFAULT_MAX_THREAD_STATES"/>.
///
/// <para/>Only takes effect when <see cref="IndexWriter"/> is first created.
/// </summary>
// LUCENENET NOTE: We cannot override a getter and add a setter,
// so must declare it new. See: http://stackoverflow.com/q/82437
new public int MaxThreadStates
{
get
{
try
{
return indexerThreadPool.MaxThreadStates;
}
catch (InvalidCastException cce)
{
throw new InvalidOperationException(cce.Message, cce);
}
}
set => this.indexerThreadPool = new DocumentsWriterPerThreadPool(value);
}
/// <summary>
/// By default, <see cref="IndexWriter"/> does not pool the
/// <see cref="SegmentReader"/>s it must open for deletions and
/// merging, unless a near-real-time reader has been
/// obtained by calling <see cref="DirectoryReader.Open(IndexWriter, bool)"/>.
/// this setting lets you enable pooling without getting a
/// near-real-time reader. NOTE: if you set this to
/// <c>false</c>, <see cref="IndexWriter"/> will still pool readers once
/// <see cref="DirectoryReader.Open(IndexWriter, bool)"/> is called.
///
/// <para/>Only takes effect when <see cref="IndexWriter"/> is first created.
/// </summary>
// LUCENENET NOTE: We cannot override a getter and add a setter,
// so must declare it new. See: http://stackoverflow.com/q/82437
new public bool UseReaderPooling
{
get => readerPooling;
set => this.readerPooling = value;
}
/// <summary>
/// Expert: Gets or sets the <see cref="DocConsumer"/> chain to be used to process documents.
///
/// <para/>Only takes effect when <see cref="IndexWriter"/> is first created.
/// </summary>
// LUCENENET NOTE: We cannot override a getter and add a setter,
// so must declare it new. See: http://stackoverflow.com/q/82437
new internal IndexingChain IndexingChain
{
get => indexingChain;
set => indexingChain = value ?? throw new ArgumentNullException(nameof(value), "IndexingChain must not be null");
}
/// <summary>
/// Expert: Gets or sets the maximum memory consumption per thread triggering a forced
/// flush if exceeded. A <see cref="DocumentsWriterPerThread"/> is forcefully flushed
/// once it exceeds this limit even if the <see cref="LiveIndexWriterConfig.RAMBufferSizeMB"/> has
/// not been exceeded. This is a safety limit to prevent a
/// <see cref="DocumentsWriterPerThread"/> from address space exhaustion due to its
/// internal 32 bit signed integer based memory addressing.
/// The given value must be less that 2GB (2048MB).
/// </summary>
/// <seealso cref="DEFAULT_RAM_PER_THREAD_HARD_LIMIT_MB"/>
// LUCENENET NOTE: We cannot override a getter and add a setter,
// so must declare it new. See: http://stackoverflow.com/q/82437
new public int RAMPerThreadHardLimitMB
{
get => perThreadHardLimitMB;
set
{
if (value <= 0 || value >= 2048)
{
throw new ArgumentException("PerThreadHardLimit must be greater than 0 and less than 2048MB");
}
this.perThreadHardLimitMB = value;
}
}
/// <summary>
/// Expert: Controls when segments are flushed to disk during indexing.
/// The <see cref="Index.FlushPolicy"/> initialized during <see cref="IndexWriter"/> instantiation and once initialized
/// the given instance is bound to this <see cref="IndexWriter"/> and should not be used with another writer.
/// </summary>
/// <seealso cref="LiveIndexWriterConfig.MaxBufferedDeleteTerms"/>
/// <seealso cref="LiveIndexWriterConfig.MaxBufferedDocs"/>
/// <seealso cref="LiveIndexWriterConfig.RAMBufferSizeMB"/>
// LUCENENET NOTE: We cannot override a getter and add a setter,
// so must declare it new. See: http://stackoverflow.com/q/82437
new internal FlushPolicy FlushPolicy
{
get => flushPolicy;
set => flushPolicy = value ?? throw new ArgumentNullException(nameof(value), "FlushPolicy must not be null");
}
// LUCENENT NOTE: The following properties would be pointless,
// since they are already inherited by the base class.
//public override InfoStream InfoStream
//{
// get
// {
// return infoStream;
// }
//}
//public override Analyzer Analyzer
//{
// get
// {
// return base.Analyzer;
// }
//}
//public override int MaxBufferedDeleteTerms
//{
// get
// {
// return base.MaxBufferedDeleteTerms;
// }
//}
//public override int MaxBufferedDocs
//{
// get
// {
// return base.MaxBufferedDocs;
// }
//}
//public override IndexReaderWarmer MergedSegmentWarmer
//{
// get
// {
// return base.MergedSegmentWarmer;
// }
//}
//public override double RAMBufferSizeMB
//{
// get
// {
// return base.RAMBufferSizeMB;
// }
//}
//public override int ReaderTermsIndexDivisor
//{
// get
// {
// return base.ReaderTermsIndexDivisor;
// }
//}
//public override int TermIndexInterval
//{
// get
// {
// return base.TermIndexInterval;
// }
//}
/// <summary>
/// Information about merges, deletes and a
/// message when maxFieldLength is reached will be printed
/// to this. Must not be <c>null</c>, but <see cref="InfoStream.NO_OUTPUT"/>
/// may be used to supress output.
/// </summary>
public IndexWriterConfig SetInfoStream(InfoStream infoStream)
{
this.infoStream = infoStream ?? throw new ArgumentNullException(nameof(infoStream),
"Cannot set InfoStream implementation to null. " +
"To disable logging use InfoStream.NO_OUTPUT");
return this;
}
/// <summary>
/// Convenience method that uses <see cref="TextWriterInfoStream"/> to write to the passed in <see cref="TextWriter"/>.
/// Must not be <c>null</c>.
/// </summary>
public IndexWriterConfig SetInfoStream(TextWriter printStream)
{
if (printStream == null)
{
throw new ArgumentException("printStream must not be null");
}
return SetInfoStream(new TextWriterInfoStream(printStream));
}
// LUCENENET NOTE: These were only here for casting purposes, but since we are
// using property setters, they are not needed
//new public IndexWriterConfig SetMaxBufferedDeleteTerms(int maxBufferedDeleteTerms)
//{
// return (IndexWriterConfig)base.SetMaxBufferedDeleteTerms(maxBufferedDeleteTerms);
//}
//new public IndexWriterConfig SetMaxBufferedDocs(int maxBufferedDocs)
//{
// return (IndexWriterConfig)base.SetMaxBufferedDocs(maxBufferedDocs);
//}
//new public IndexWriterConfig SetMergedSegmentWarmer(IndexReaderWarmer mergeSegmentWarmer)
//{
// return (IndexWriterConfig)base.SetMergedSegmentWarmer(mergeSegmentWarmer);
//}
//new public IndexWriterConfig SetRAMBufferSizeMB(double ramBufferSizeMB)
//{
// return (IndexWriterConfig)base.SetRAMBufferSizeMB(ramBufferSizeMB);
//}
//new public IndexWriterConfig SetReaderTermsIndexDivisor(int divisor)
//{
// return (IndexWriterConfig)base.SetReaderTermsIndexDivisor(divisor);
//}
//new public IndexWriterConfig SetTermIndexInterval(int interval)
//{
// return (IndexWriterConfig)base.SetTermIndexInterval(interval);
//}
//new public IndexWriterConfig SetUseCompoundFile(bool useCompoundFile)
//{
// return (IndexWriterConfig)base.SetUseCompoundFile(useCompoundFile);
//}
//new public IndexWriterConfig SetCheckIntegrityAtMerge(bool checkIntegrityAtMerge)
//{
// return (IndexWriterConfig)base.SetCheckIntegrityAtMerge(checkIntegrityAtMerge);
//}
public override string ToString()
{
StringBuilder sb = new StringBuilder(base.ToString());
sb.Append("writer=").Append(writer).Append("\n");
return sb.ToString();
}
}
/// <summary>
/// Specifies the open mode for <see cref="IndexWriter"/>.
/// </summary>
public enum OpenMode // LUCENENET specific: De-nested from IndexWriterConfig to prevent naming conflict
{
/// <summary>
/// Creates a new index or overwrites an existing one.
/// </summary>
CREATE,
/// <summary>
/// Opens an existing index.
/// </summary>
APPEND,
/// <summary>
/// Creates a new index if one does not exist,
/// otherwise it opens the index and documents will be appended.
/// </summary>
CREATE_OR_APPEND
}
}