Table of Contents

Method ForceMerge

Namespace
TantivyDotNet
Assembly
TantivyDotNet.dll

ForceMerge(int)

Merges the committed segments until at most maxSegments remain, and rewrites segments that contain deleted documents to drop them. Blocks until done. Typically called once after building an index that is then only read: fewer segments make searches faster.

public void ForceMerge(int maxSegments = 1)

Parameters

maxSegments int

The number of segments to merge down to. Default 1.

Remarks

Only committed segments are merged; call Commit() first. Uncommitted changes stay pending. Background merges are paused meanwhile. Merging rewrites the index, so it temporarily needs up to twice the disk space, and the replaced files remain until no searcher uses them (see GarbageCollectFiles()). Searchers created before the merge keep their snapshot.