Minimizes the number of index segments by merging them, improving search performance.
An index optimization operation reduces the number of segments in an index, thereby increasing search performance. Each indexing operation adds at least one new segment, so indexes that receive frequent document additions should be optimized periodically.
defoptimize(self):...
Example
fromgroupdocs.searchimportIndex# Create or open an indexindex=Index("./index")# Add documents to the index (each call creates at least one new segment)index.add("./documents")# Re-index only documents changed since the last add/updateindex.update()# Merge segments for faster subsequent searchesindex.optimize()
optimize
Minimizes the number of index segments by merging them, improving search performance.
An index optimization operation reduces the number of segments in an index, thereby increasing search performance. Each indexing operation adds at least one new segment, so indexes that receive frequent document additions should be optimized periodically.
defoptimize(self,options):...
Parameter
Type
Description
options
MergeOptions
The merge options.
Aliases
These names call optimize too, limited to the overloads listed.