Just like {@link #Optimize(int)}, except you can specify whether the call should block until the optimize completes. This is only meaningful with a {@link MergeScheduler} that is able to run merges in background threads.

NOTE: if this method hits an OutOfMemoryError you should immediately close the writer. See above for details.

Namespace: Lucene.Net.Index
Assembly: Lucene.Net (in Lucene.Net.dll) Version: 2.9.4.1

Syntax

C#
public virtual void Optimize(
	int maxNumSegments,
	bool doWait
)
Visual Basic
Public Overridable Sub Optimize ( _
	maxNumSegments As Integer, _
	doWait As Boolean _
)
Visual C++
public:
virtual void Optimize(
	int maxNumSegments, 
	bool doWait
)

Parameters

maxNumSegments
Type: System..::..Int32

[Missing <param name="maxNumSegments"/> documentation for "M:Lucene.Net.Index.IndexWriter.Optimize(System.Int32,System.Boolean)"]

doWait
Type: System..::..Boolean

[Missing <param name="doWait"/> documentation for "M:Lucene.Net.Index.IndexWriter.Optimize(System.Int32,System.Boolean)"]

See Also