Contents

SKIndexCompact(_:)

Invokes all pending updates associated with an index, compacts the index if compaction is needed, and commits all changes to backing store.

Declaration

func SKIndexCompact(_ inIndex: SKIndex!) -> Bool

Parameters

  • inIndex:

    The index you want to compact.

Return Value

A Boolean value of true on success, or false on failure.

Discussion

Over time, as document URL objects (of type SKDocument) and associated contents get added to and removed from an index, the index’s disk or memory footprint may grow due to fragmentation.

Compacting can take a significant amount of time. Do not call SKIndexCompact(_:) on the main thread in an application with a user interface. Call it only if the index is significantly fragmented and according to the needs of your application.

Calling SKIndexCompact(_:) changes the block allocation for an index’s backing store. Close all clients of an index before calling this function.

See Also

Managing Indexes