Invokes all pending updates associated with an index and commits them to backing store.
- macOS 10.3+
- Core Services
The index you want to update and commit to backing store.
A Boolean value of
true on success, or
false on failure.
An on-disk or memory-based index becomes stale when your application updates it by adding or removing a document entry. A search on an index in such a state won’t have access to the nonflushed updates. The solution is to call this function before searching.
SKIndex flushes index-update information and commits memory-based index caches to disk, in the case of an on-disk index, or to a memory object, in the case of a memory-based index. In both cases, calling this function makes the state of the index consistent.
Before searching an index, always call
SKIndex, even though the flush process may take up to several seconds. If there are no updates to commit, a call to
SKIndex does nothing and takes minimal time.
A new Search Kit index does not have term IDs until it is flushed.
Search Kit is thread-safe. You can use separate indexing and searching threads. Your application is responsible for ensuring that no more than one process is open at a time for writing to an index.