Mac Developer Library

Developer

CoreServices Framework Reference SearchKit Reference

Options
Deployment Target:

On This Page
Language:

SearchKit Reference

Search Kit is a powerful and streamlined C language framework for indexing and searching text in most human languages. It provides fast information retrieval in System Preferences, Address Book, Help Viewer, and Xcode. Apple’s Spotlight technology is built on top of Search Kit to provide content searching in Finder, Mail, and the Spotlight menu.

You can use Search Kit or Spotlight to provide similar functionality and powerful information-access capabilities within your Mac app. Search Kit is appropriate when you want your application to have full control over indexing and searching, and when your focus is file content. Search Kit is thread-safe and works with Cocoa and command-line tools.

Search Kit supports phrase searches, prefix/suffix/substring searches, Boolean searches, summarization, and relevance ranking. Search Kit uses Spotlight’s metadata importers when indexing documents and takes advantage of any additional importers available on a system.

Functions

Search Kit performs its searches not on documents but on its indexes of documents. The functions in this group let your application create memory-based and persistent indexes. Indexes are initially empty. Functions in Managing Indexes let you add document content to these indexes.

  • Creates a named index in a file whose location is specified with a CFURL object.

    Declaration

    Swift

    func SKIndexCreateWithURL(_ inURL: CFURL!, _ inIndexName: CFString!, _ inIndexType: SKIndexType, _ inAnalysisProperties: CFDictionary!) -> Unmanaged<SKIndex>!

    Objective-C

    SKIndexRef SKIndexCreateWithURL ( CFURLRef inURL, CFStringRef inIndexName, SKIndexType inIndexType, CFDictionaryRef inAnalysisProperties );

    Parameters

    inURL

    The location of the index.

    inIndexName

    The name of the index. If you call this function with inIndexName set to NULL, Search Kit assigns the index the default index name IADefaultIndex. If you then attempt to create a second index in the same file without assigning a name, no second index is created and this function returns NULL. Search Kit does not currently support retrieving index names from an index.

    inIndexType

    The index type. See “SKIndexType”.

    inAnalysisProperties

    The text analysis properties dictionary, which optionally sets the minimum term length, stopwords, term substitutions, maximum unique terms to index, and proximity support (for phrase-based searches) when creating the index. See “Text Analysis Keys”. To get the analysis properties of an index, use the SKIndexGetAnalysisProperties function. The inAnalysisProperties parameter can be NULL, in which case Search Kit applies the default dictionary, which is NULL.

    Return Value

    A unique reference to the newly created index.

    Discussion

    SKIndexCreateWithURL creates an index in a file. Search Kit indexes are initially empty. Use this function when your application needs persistent storage of an index. To create a memory-based, nonpersistent index, use SKIndexCreateWithMutableData.

    A file can contain more than one index. To add a new index to an existing file, use the same value for inURL and supply a new name for inIndexName.

    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.

    When your application no longer needs the index, dispose of it by calling SKIndexClose.

    Special Considerations

    You cannot use CFMakeCollectable with SKIndexRef objects.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Creates a named index stored in a CFMutableDataRef object.

    Declaration

    Swift

    func SKIndexCreateWithMutableData(_ inData: CFMutableData!, _ inIndexName: CFString!, _ inIndexType: SKIndexType, _ inAnalysisProperties: CFDictionary!) -> Unmanaged<SKIndex>!

    Objective-C

    SKIndexRef SKIndexCreateWithMutableData ( CFMutableDataRef inData, CFStringRef inIndexName, SKIndexType inIndexType, CFDictionaryRef inAnalysisProperties );

    Parameters

    inData

    An empty CFMutableDataRef object to contain the index being created.

    inIndexName

    The name of the index. If you call this function with inIndexName set to NULL, Search Kit assigns the index the default index name IADefaultIndex. If you then attempt to create a second index in the same file without assigning a name, no second index is created and this function returns NULL. Search Kit does not support retrieving index names from an index.

    inIndexType

    The index type. See “SKIndexType”.

    inAnalysisProperties

    The text analysis properties dictionary, which optionally sets the minimum term length, stopwords, term substitutions, maximum unique terms to index, and proximity support (for phrase-based searches) when creating the index. See “Text Analysis Keys”. The inAnalysisProperties parameter can be NULL, in which case Search Kit applies the default dictionary, which is NULL.

    Return Value

    The newly created index.

    Discussion

    SKIndexCreateWithMutableData creates an index in memory as a CFMutableDataRef object. Search Kit indexes are initially empty. A memory-based index is useful for quick searching and when your application doesn’t need persistent storage. To create a disk-based, persistent index, use the SKIndexCreateWithURL function.

    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.

    This function retains the data object you provide in the inData parameter.

    When your application no longer needs the index, dispose of it by calling SKIndexClose.

    Special Considerations

    You cannot use CFMakeCollectable with SKIndexRef objects.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Opens an existing, named index for searching only.

    Declaration

    Swift

    func SKIndexOpenWithData(_ inData: CFData!, _ inIndexName: CFString!) -> Unmanaged<SKIndex>!

    Objective-C

    SKIndexRef SKIndexOpenWithData ( CFDataRef inData, CFStringRef inIndexName );

    Parameters

    inData

    The index to open.

    inIndexName

    The name of the index. Can be NULL, in which case this function attempts to open the index with the default name of IADefaultIndex.

    Return Value

    The named index, or NULL on failure.

    Discussion

    An index opened by SKIndexOpenWithData can be searched but not updated. To open an index for updating, use SKIndexOpenWithMutableData.

    If inIndexName is NULL and inData does not contain an index with the default name, this function returns NULL.

    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.

    A call to SKIndexOpenWithData retains the opened index. When your application no longer needs the index, dispose of it by calling SKIndexClose.

    Special Considerations

    You cannot use CFMakeCollectable with SKIndexRef objects.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Opens an existing, named index for searching and updating.

    Declaration

    Swift

    func SKIndexOpenWithMutableData(_ inData: CFMutableData!, _ inIndexName: CFString!) -> Unmanaged<SKIndex>!

    Objective-C

    SKIndexRef SKIndexOpenWithMutableData ( CFMutableDataRef inData, CFStringRef inIndexName );

    Parameters

    inData

    The index to open.

    inIndexName

    The name of the index. Can be NULL, in which case this function attempts to open the index with the default name of IADefaultIndex.

    Return Value

    The named index, or NULL on failure.

    Discussion

    An index opened by SKIndexOpenWithMutableData may be searched or updated. To open an index for search only, use the SKIndexOpenWithData function.

    If inIndexName is NULL and inData does not contain an index with the default name, this function returns NULL.

    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.

    A call to SKIndexOpenWithMutableData retains the opened index. When your application no longer needs the index, dispose of it by calling SKIndexClose.

    Special Considerations

    You cannot use CFMakeCollectable with SKIndexRef objects.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Opens an existing, named index stored in a file whose location is specified with a CFURL object.

    Declaration

    Swift

    func SKIndexOpenWithURL(_ inURL: CFURL!, _ inIndexName: CFString!, _ inWriteAccess: Boolean) -> Unmanaged<SKIndex>!

    Objective-C

    SKIndexRef SKIndexOpenWithURL ( CFURLRef inURL, CFStringRef inIndexName, Boolean inWriteAccess );

    Parameters

    inURL

    The location of the index.

    inIndexName

    The name of the index. Can be NULL, in which case this function attempts to open the index with the default name of IADefaultIndex.

    inWriteAccess

    A Boolean value indicating whether the index is open for updating. To open an index for searching only, pass false (0 or kCFBoolenFalse). To open it for searching and updating, pass true (1 or kCFBooleanTrue).

    Return Value

    The named index, or NULL on failure.

    Discussion

    If inIndexName is NULL and inData does not contain an index with the default name, this function returns NULL.

    A call to SKIndexOpenWithURL retains the opened index. When your application no longer needs the index, dispose of it by calling SKIndexClose.

    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.

    Special Considerations

    You cannot use CFMakeCollectable with SKIndexRef objects.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Closes an index.

    Declaration

    Swift

    func SKIndexClose(_ inIndex: SKIndex!)

    Objective-C

    void SKIndexClose ( SKIndexRef inIndex );

    Parameters

    inIndex

    The index to close.

    Discussion

    When your application no longer needs an index that it has opened or created, call SKIndexClose. Calling this function is equivalent to calling CFRelease on an index.

    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.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Gets the category of an index.

    Declaration

    Swift

    func SKIndexGetIndexType(_ inIndex: SKIndex!) -> SKIndexType

    Objective-C

    SKIndexType SKIndexGetIndexType ( SKIndexRef inIndex );

    Parameters

    inIndex

    The index whose category you want to know.

    Return Value

    The category of the index. See the “SKIndexType” enumeration for a list of the various index categories. On failure, returns a value of kSKIndexUnknown.

    Discussion

    As described in “SKIndexType”, Search Kit offers four categories of index, each optimized for one or more types of searching.

    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.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets the type identifier for Search Kit indexes.

    Declaration

    Swift

    func SKIndexGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID SKIndexGetTypeID ( void );

    Return Value

    A CFTypeID object containing the type identifier for the SKIndexRef opaque type.

    Discussion

    Search Kit represents indexes with the SKIndexRef opaque type. If your code needs to determine whether a particular data type is an index, you can use this function along with the CFGetTypeID function and perform a comparison.

    Never hard-code the index type ID because it can change from one release of OS X to another.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

The functions in this section let your application add document content to (and remove document content from) indexes, work with memory- and disk-based indexes, and retrieve metadata from indexes.

  • Adds a document URL (SKDocumentRef) object, and the associated document’s textual content, to an index.

    Declaration

    Swift

    func SKIndexAddDocumentWithText(_ inIndex: SKIndex!, _ inDocument: SKDocument!, _ inDocumentText: CFString!, _ inCanReplace: Boolean) -> Boolean

    Objective-C

    Boolean SKIndexAddDocumentWithText ( SKIndexRef inIndex, SKDocumentRef inDocument, CFStringRef inDocumentText, Boolean inCanReplace );

    Parameters

    inIndex

    The index to which you are adding the document URL object (SKDocumentRef) .

    inDocument

    The document URL (SKDocumentRef) object to add.

    inDocumentText

    The document text. Can be NULL.

    inCanReplace

    A Boolean value specifying whether Search Kit will overwrite a document’s index entry (true, indicated by 1 or kCFBooleanTrue), or retain the entry if it exists (false, indicated by 0 or kCFBoolenFalse).

    Return Value

    A Boolean value of true on success, or false on failure. Also returns false if the document has an entry in the index and inCanReplace is set to false.

    Discussion

    Use this function to add the textual contents of arbitrary document types to an index. With this function, your application takes responsibility for getting textual content and handing it to the index as A CFStringRef object. Because of this, your application can define what it considers to be a document—a database record, a tagged field in an XML document, an object in memory, a text file, and so on.

    Search Kit will index any size text string that you give it, up to its 4 GB index file size limit.

    To add the textual content of file-based documents to a Search Kit index, you can use this function or take advantage of Search Kit’s ability to locate and read certain on-disk, file-based document types—see SKIndexAddDocument.

    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.

    A single Search Kit index file can be up to 4 GB in size.

    Special Considerations

    In OS X v10.3, some functions do not provide expected results unless you follow a call to SKIndexAddDocumentWithText with a call to SKIndexFlush. The affected functions include SKIndexGetDocumentCount, SKIndexGetDocumentTermCount, SKIndexGetDocumentTermFrequency, and SKIndexGetTermDocumentCount. However, in typical use this won’t be an issue, because applications call these functions after a search, and you must call SKIndexFlush before a search.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Adds location information for a file-based document, and the document’s textual content, to an index.

    Declaration

    Swift

    func SKIndexAddDocument(_ inIndex: SKIndex!, _ inDocument: SKDocument!, _ inMIMETypeHint: CFString!, _ inCanReplace: Boolean) -> Boolean

    Objective-C

    Boolean SKIndexAddDocument ( SKIndexRef inIndex, SKDocumentRef inDocument, CFStringRef inMIMETypeHint, Boolean inCanReplace );

    Parameters

    inIndex

    The index to which you are adding the document URL object (SKDocumentRef).

    inDocument

    The document URL object (of type SKDocumentRef) , containing a file-based document’s location information, to add to the index. You can release the document URL object immediately after adding it to the index.

    inMIMETypeHint

    The MIME type hint for the specified file-based document. Can be NULL. In Search Kit, common MIME type hints include text/plain, text/rtf, text/html, text/pdf, and application/msword.

    Specify a MIME type hint to help Spotlight determine which of its metadata importers to use when Search Kit is indexing a file-based document. Search Kit uses filename extensions and type/creator codes in attempting to determine file types when indexing files. See SKLoadDefaultExtractorPlugIns. You can circumvent Search Kit’s file type determination process, or override it, by using a MIME type hint.

    inCanReplace

    A Boolean value specifying whether Search Kit will overwrite a document’s index entry (true, indicated by 1 or kCFBooleanTrue), or retain the entry if it exists (false, indicated by 0 or kCFBoolenFalse).

    Return Value

    A Boolean value of true on success, or false on failure. Also returns false if the document has an entry in the index and inCanReplace is set to false.

    Discussion

    The document scheme must be of type “file” to use this function. If it’s not, call SKIndexAddDocumentWithText instead. For more information on schemes, see http://www.iana.org/assignments/uri-schemes.html.

    This function uses the referenced document and the optional MIME type hint to get the document’s textual content using the Spotlight metadata importers. If you do not supply a MIME type hint, Spotlight’s importers will use filename extensions and type/creator codes to guess file types.

    Search Kit indexes any nonexecutable file associated with a document URL object (of type SKDocumentRef) that you hand to this function, even nontext files such as images. Your application takes responsibility for ensuring that the document URL objects you pass to SKIndexAddDocument are in fact the locations of files you want to index.

    If your application did not call SKLoadDefaultExtractorPlugIns, Search Kit indexes the first 10 MB of a document. Otherwise, Search Kit indexes the entire document up to the index file size limit of 4 GB.

    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.

    A single Search Kit index can hold up to 4 billion document URL objects and their associated textual content.

    Special Considerations

    In the current implementation of Search Kit, some functions do not provide expected results unless you follow SKIndexAddDocument with a call to SKIndexFlush. The affected functions include SKIndexGetDocumentCount, SKIndexGetDocumentTermCount, SKIndexGetDocumentTermFrequency, and SKIndexGetTermDocumentCount. However, in typical use this won’t be an issue, because applications call these functions after a search, and you must call SKIndexFlush before a search.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Invokes all pending updates associated with an index and commits them to backing store.

    Declaration

    Swift

    func SKIndexFlush(_ inIndex: SKIndex!) -> Boolean

    Objective-C

    Boolean SKIndexFlush ( SKIndexRef inIndex );

    Parameters

    inIndex

    The index you want to update and commit to backing store.

    Return Value

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

    Discussion

    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. SKIndexFlush 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 SKIndexFlush, even though the flush process may take up to several seconds. If there are no updates to commit, a call to SKIndexFlush 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.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

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

    Declaration

    Swift

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

    Objective-C

    Boolean SKIndexCompact ( SKIndexRef inIndex );

    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 SKDocumentRef) 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.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets the total number of documents represented in an index.

    Declaration

    Swift

    func SKIndexGetDocumentCount(_ inIndex: SKIndex!) -> CFIndex

    Objective-C

    CFIndex SKIndexGetDocumentCount ( SKIndexRef inIndex );

    Parameters

    inIndex

    The index whose document URL objects (of type SKDocumentRef) you want to count.

    Return Value

    A CFIndex object containing the number of document URL objects (of type SKDocumentRef) in the index. On failure, returns 0.

    Discussion

    Document URL objects (of type SKDocumentRef) added to an index have an indexing state of kSKDocumentStateIndexed. See the “SKDocumentIndexState” enumeration.

    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.

    Special Considerations

    In the current implementation of Search Kit, SKIndexGetDocumentCount returns the number of documents represented in the on-disk index. If your application has added document URL objects to the index but has not yet called SKIndexFlush, the document count may not be correct.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets the highest-numbered document ID in an index.

    Declaration

    Swift

    func SKIndexGetMaximumDocumentID(_ inIndex: SKIndex!) -> SKDocumentID

    Objective-C

    SKDocumentID SKIndexGetMaximumDocumentID ( SKIndexRef inIndex );

    Parameters

    inIndex

    An index.

    Return Value

    A document ID object containing the highest-numbered document ID in the index.

    Discussion

    Use this function with SKIndexGetDocumentCount to determine whether an index is fragmented and in need of compaction. See SKIndexCompact.

    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.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets the highest-numbered term ID in an index.

    Declaration

    Swift

    func SKIndexGetMaximumTermID(_ inIndex: SKIndex!) -> CFIndex

    Objective-C

    CFIndex SKIndexGetMaximumTermID ( SKIndexRef inIndex );

    Parameters

    inIndex

    An index.

    Return Value

    A CFIndex object containing the highest-numbered term ID in an index.

    Discussion

    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.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Creates an index-based iterator for document URL objects (of type SKDocumentRef) owned by a parent document URL object.

    Declaration

    Swift

    func SKIndexDocumentIteratorCreate(_ inIndex: SKIndex!, _ inParentDocument: SKDocument!) -> Unmanaged<SKIndexDocumentIterator>!

    Objective-C

    SKIndexDocumentIteratorRef SKIndexDocumentIteratorCreate ( SKIndexRef inIndex, SKDocumentRef inParentDocument );

    Parameters

    inIndex

    The index you want to iterate across.

    inParentDocument

    The document URL object that is the parent of the document URL objects you want to examine. Pass NULL to get the top item in an index. See SKDocumentRef for a discussion of how to get the full URL for a document URL object.

    Return Value

    An index-based document iterator.

    Discussion

    When you want to iterate across all the documents represented in an index, use this function to create an iterator and then call SKIndexDocumentIteratorCopyNext in turn for each document URL object (of type SKDocumentRef) in the index.

    Document iterators iterate over a single level of an index. Your code is responsible for descending through a hierarchy of documents in an index.

    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.

    When your application no longer needs the iterator, dispose of it by calling CFRelease.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Obtains the next document URL object (of type SKDocumentRef) from an index using a document iterator.

    Declaration

    Swift

    func SKIndexDocumentIteratorCopyNext(_ inIterator: SKIndexDocumentIterator!) -> Unmanaged<SKDocument>!

    Objective-C

    SKDocumentRef SKIndexDocumentIteratorCopyNext ( SKIndexDocumentIteratorRef inIterator );

    Parameters

    inIterator

    The index-based document iterator. See SKIndexDocumentIteratorCreate for information on creating an document iterator, and SKIndexDocumentIteratorRef for more about iterators.

    Return Value

    The next document URL object in the index.

    Discussion

    This function returns NULL when there are no more document URL objects (of type SKDocumentRef) in the index. When finished iterating, your application must call CFRelease on all retrieved document URL objects that are non-NULL.

    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.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets the type identifier for Search Kit document iterators.

    Declaration

    Swift

    func SKIndexDocumentIteratorGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID SKIndexDocumentIteratorGetTypeID ( void );

    Return Value

    A CFTypeID object containing the type identifier for the SKIndexDocumentIterator opaque type.

    Discussion

    Search Kit represents document iterators with the SKIndexDocumentIteratorRef opaque type. If your code needs to determine whether a particular data type is a document iterator, you can use this function along with the CFGetTypeID function and perform a comparison.

    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.

    Never hard-code the document iterator type ID because it can change from one release of OS X to another.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets the text analysis properties of an index.

    Declaration

    Swift

    func SKIndexGetAnalysisProperties(_ inIndex: SKIndex!) -> Unmanaged<CFDictionary>!

    Objective-C

    CFDictionaryRef SKIndexGetAnalysisProperties ( SKIndexRef inIndex );

    Parameters

    inIndex

    The index whose text-analysis properties you want to get.

    Return Value

    A CFDictionary object containing the index’s text-analysis properties. On failure, returns NULL.

    Discussion

    The text analysis properties of an index determine how searches behave when querying the index. You set the analysis properties when creating an index with the SKIndexCreateWithURL or SKIndexCreateWithMutableData functions. For more information on text-analysis properties, see “Text Analysis Keys”.

    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.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Changes the parent of a document URL object (of type SKDocumentRef) in an index.

    Declaration

    Swift

    func SKIndexMoveDocument(_ inIndex: SKIndex!, _ inDocument: SKDocument!, _ inNewParent: SKDocument!) -> Boolean

    Objective-C

    Boolean SKIndexMoveDocument ( SKIndexRef inIndex, SKDocumentRef inDocument, SKDocumentRef inNewParent );

    Parameters

    inIndex

    The index containing the document URL object you want to move.

    inDocument

    The document URL object you want to move.

    inNewParent

    The new parent document URL object for the document URL object you want to move.

    Return Value

    A Boolean value of true for a successful move, or false on failure.

    Discussion

    When your application moves a document, use this function to update the index to reflect the change.

    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.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Removes a document URL object (of type SKDocumentRef) and its children, if any, from an index.

    Declaration

    Swift

    func SKIndexRemoveDocument(_ inIndex: SKIndex!, _ inDocument: SKDocument!) -> Boolean

    Objective-C

    Boolean SKIndexRemoveDocument ( SKIndexRef inIndex, SKDocumentRef inDocument );

    Parameters

    inIndex

    The index from which you want to remove the document URL object (SKDocumentRef).

    inDocument

    The document URL object to remove.

    Return Value

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

    Discussion

    When your application deletes a document, use this function to update the index to reflect the change.

    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.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Changes the name of a document URL object (of type SKDocumentRef) in an index.

    Declaration

    Swift

    func SKIndexRenameDocument(_ inIndex: SKIndex!, _ inDocument: SKDocument!, _ inNewName: CFString!) -> Boolean

    Objective-C

    Boolean SKIndexRenameDocument ( SKIndexRef inIndex, SKDocumentRef inDocument, CFStringRef inNewName );

    Parameters

    inIndex

    The index containing the document URL object whose name you want to change.

    inDocument

    The document URL object whose name you want to change.

    inNewName

    The new name for the document URL object.

    Return Value

    A Boolean value of true if the document URL object name was successfully changed, or false on failure.

    Discussion

    When your application changes the name of a document, use this function to update the index to reflect the change.

    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.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Not recommended. Sets the memory size limit for updates to an index, measured in bytes.

    Declaration

    Swift

    func SKIndexSetMaximumBytesBeforeFlush(_ inIndex: SKIndex!, _ inBytesForUpdate: CFIndex)

    Objective-C

    void SKIndexSetMaximumBytesBeforeFlush ( SKIndexRef inIndex, CFIndex inBytesForUpdate );

    Discussion

    This function is rarely needed and is likely to be deprecated. Search Kit keeps track of index updates that are not yet committed to disk. Apple recommends using the default memory size limit for index updates, which is currently 2 million bytes.

    Special Considerations

    Apple recommends use of the SKIndexFlush function instead of SKIndexSetMaximumBytesBeforeFlush.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Not recommended. Gets the memory size limit for updates to an index, measured in bytes.

    Declaration

    Swift

    func SKIndexGetMaximumBytesBeforeFlush(_ inIndex: SKIndex!) -> CFIndex

    Objective-C

    CFIndex SKIndexGetMaximumBytesBeforeFlush ( SKIndexRef inIndex );

    Special Considerations

    This function is rarely needed and is likely to be deprecated. Apple recommends using the SKIndexFlush function along with the default memory size limit for index updates. Refer to the SKIndexSetMaximumBytesBeforeFlush function for more information.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

Search Kit can import the textual content of file-based documents into indexes using the Spotlight metadata importers.

  • Tells Search Kit to use the Spotlight metadata importers.

    Declaration

    Swift

    func SKLoadDefaultExtractorPlugIns()

    Objective-C

    void SKLoadDefaultExtractorPlugIns ( void );

    Discussion

    The Spotlight metadata importers determine the kMDItemTextContent property for each document passed to the SKIndexAddDocument function.

    Call the SKLoadDefaultExtractorPlugIns function once at application launch to tell Search Kit to use the Spotlight metadata importers. The function SKIndexAddDocument will then use Spotlight’s importers to extract the text from supported files and place that text into an index, leaving the markup behind.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

From Search Kit’s perspective, a document is anything that contains text—an RTF document, a PDF file, a Mail message, an Address Book entry, an Internet URL, the result of a database query, and so on.

The functions in this section let your application create new document URL objects (SKDocumentRefs), retrieve metadata from documents, get information on document hierarchies, and work with documents and their terms in the context of Search Kit indexes.

  • Creates a document URL object (of type SKDocumentRef) from a CFURLRef object.

    Declaration

    Swift

    func SKDocumentCreateWithURL(_ inURL: CFURL!) -> Unmanaged<SKDocument>!

    Objective-C

    SKDocumentRef SKDocumentCreateWithURL ( CFURLRef inURL );

    Parameters

    inURL

    The URL for the document URL object (of type SKDocumentRef) you are creating. The scheme of the document URL object gets set to the scheme of the URL used. Only URLs with a scheme of “file” can be used with the SKIndexAddDocument function, but the URL scheme may be anything you like if you use the SKIndexAddDocumentWithText function. For more information on schemes, see http://www.iana.org/assignments/uri-schemes.html.

    Return Value

    The new document URL object, or NULL if the document URL object could not be created.

    Discussion

    Use SKDocumentCreateWithURL to create a unique reference to a file or to another, arbitrary URL that your application will use as a document URL object (of type SKDocumentRef). When your application no longer needs the document URL object, dispose of it by calling CFRelease.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Creates a document URL object (of type SKDocumentRef) based on a scheme, parent, and name.

    Declaration

    Swift

    func SKDocumentCreate(_ inScheme: CFString!, _ inParent: SKDocument!, _ inName: CFString!) -> Unmanaged<SKDocument>!

    Objective-C

    SKDocumentRef SKDocumentCreate ( CFStringRef inScheme, SKDocumentRef inParent, CFStringRef inName );

    Parameters

    inScheme

    The scheme to use—analogous to the scheme of a URL. Only documents referenced with the “file” scheme can be read by the SKIndexAddDocument function. The scheme can be anything you like if you use the SKIndexAddDocumentWithText function. The scheme can be NULL, in which case it will be set to be the same scheme as the document URL object’s parent. For more information on schemes, see http://www.iana.org/assignments/uri-schemes.html.

    inParent

    The document URL object one step up in the document hierarchy. Can be NULL.

    inName

    The name of the document that you’re creating a document URL object for. For the “file” scheme, it is the name of the file or the container, not its path. The path can be constructed by following parent links. The maximum length for a document name is 256 bytes.

    Return Value

    The new document URL object, or NULL on failure.

    Discussion

    The new document URL object’s parent can be NULL, but you must specify either a scheme or a parent. When your application no longer needs the document URL object, dispose of it by calling CFRelease.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Builds a CFURLRef object from a document URL object (of type SKDocumentRef).

    Declaration

    Swift

    func SKDocumentCopyURL(_ inDocument: SKDocument!) -> Unmanaged<CFURL>!

    Objective-C

    CFURLRef SKDocumentCopyURL ( SKDocumentRef inDocument );

    Parameters

    inDocument

    The document URL object that you want a CFURLRef object for.

    Return Value

    A CFURLRef object representing a document location, or NULL on failure.

    Discussion

    You can use this function to create a CFURLRef object to represent a document’s location. Do this to gain access to the Core Foundation functionality provided by CFURLRef. This functionality includes accessing parts of the URL string, getting properties of the URL, and converting the URL to other representations.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets the name of a document URL object (of type SKDocumentRef).

    Declaration

    Swift

    func SKDocumentGetName(_ inDocument: SKDocument!) -> Unmanaged<CFString>!

    Objective-C

    CFStringRef SKDocumentGetName ( SKDocumentRef inDocument );

    Parameters

    inDocument

    The document URL object whose name you want to get.

    Return Value

    A CFStringRef object containing the document URL object’s name, or NULL on failure.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets the parent of a document URL object (of type SKDocumentRef).

    Declaration

    Swift

    func SKDocumentGetParent(_ inDocument: SKDocument!) -> Unmanaged<SKDocument>!

    Objective-C

    SKDocumentRef SKDocumentGetParent ( SKDocumentRef inDocument );

    Parameters

    inDocument

    The document URL object whose parent you want to get.

    Return Value

    The parent document URL object, or NULL on failure.

    Discussion

    Search Kit manages document locations in terms of URLs as Document URL objects (of type SKDocumentRef). The parent document URL object typically contains the document’s URL up to but not including the document name.

    Typically, document URL objects contain the complete URL to a file-based document. But you can use this function iteratively to build up the complete file-system path for a document that you are managing as part of a document hierarchy. See the description for the SKDocumentRef function for more on this.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets the scheme name for a document URL object (of type SKDocumentRef).

    Declaration

    Swift

    func SKDocumentGetSchemeName(_ inDocument: SKDocument!) -> Unmanaged<CFString>!

    Objective-C

    CFStringRef SKDocumentGetSchemeName ( SKDocumentRef inDocument );

    Parameters

    inDocument

    The document URL object (of type SKDocumentRef) whose scheme you want to get.

    Return Value

    A CFStringRef object containing the document URL object’s scheme name, or NULL on failure.

    Discussion

    The scheme of a document URL object (of type SKDocumentRef), which represents how it can be accessed, can be any character string but is typically “file” or “http”. The scheme is one of a Search Kit document URL object’s three properties—see SKDocumentRef for details.

    For more information on schemes, see http://www.iana.org/assignments/uri-schemes.html

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets the type identifier for Search Kit document URL objects.

    Declaration

    Swift

    func SKDocumentGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID SKDocumentGetTypeID ( void );

    Return Value

    A CFTypeID object containing the type identifier for the document URL object (of type SKDocumentRef).

    Discussion

    Search Kit represents document URL objects with the SKDocumentRef opaque type. If your code needs to determine whether a particular data type is a document URL object, you can use this function along with the CFGetTypeID function and perform a comparison.

    Never hard-code the document URL object type ID because it can change from one release of OS X to another.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Obtains a document URL object (of type SKDocumentRef) from an index.

    Declaration

    Swift

    func SKIndexCopyDocumentForDocumentID(_ inIndex: SKIndex!, _ inDocumentID: SKDocumentID) -> Unmanaged<SKDocument>!

    Objective-C

    SKDocumentRef SKIndexCopyDocumentForDocumentID ( SKIndexRef inIndex, SKDocumentID inDocumentID );

    Parameters

    inIndex

    The index containing the document URL object.

    inDocumentID

    The ID of the document URL object you want to copy.

    Return Value

    A Search Kit document URL object.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets document names and parent IDs based on document IDs.

    Declaration

    Swift

    func SKIndexCopyInfoForDocumentIDs(_ inIndex: SKIndex!, _ inCount: CFIndex, _ inDocumentIDsArray: UnsafeMutablePointer<SKDocumentID>, _ outNamesArray: UnsafeMutablePointer<Unmanaged<CFString>?>, _ outParentIDsArray: UnsafeMutablePointer<SKDocumentID>)

    Objective-C

    void SKIndexCopyInfoForDocumentIDs ( SKIndexRef inIndex, CFIndex inCount, SKDocumentID *inDocumentIDsArray, CFStringRef *outNamesArray, SKDocumentID *outParentIDsArray );

    Parameters

    inIndex

    The index containing the document information.

    inCount

    The number of document IDs in inDocumentIDsArray.

    inDocumentIDsArray

    Points to an array of document IDs representing the documents whose names and parent IDs you want.

    outNamesArray

    On input, a pointer to an array for document names. On output, points to the previously allocated array, which now contains the document names corresponding to the document IDs in inDocumentIDsArray. May be NULL on input if you don’t want to get the document names.

    When finished with the names array, dispose of it by calling CFRelease on each array element.

    outParentIDsArray

    On input, a pointer to an array for parent document IDs. On output, points to the previously allocated array, which now contains document IDs representing the parents of the documents whose IDs are in inDocumentIDsArray. May be NULL on input if you don’t want to get the parent document IDs.

    Discussion

    The SKIndexCopyInfoForDocumentIDs function lets you get a batch of document names and parent document IDs in one step, based on a list of document IDs.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Gets document URL objects (of type SKDocumentRef) based on document IDs.

    Declaration

    Swift

    func SKIndexCopyDocumentRefsForDocumentIDs(_ inIndex: SKIndex!, _ inCount: CFIndex, _ inDocumentIDsArray: UnsafeMutablePointer<SKDocumentID>, _ outDocumentRefsArray: UnsafeMutablePointer<Unmanaged<SKDocument>?>)

    Objective-C

    void SKIndexCopyDocumentRefsForDocumentIDs ( SKIndexRef inIndex, CFIndex inCount, SKDocumentID *inDocumentIDsArray, SKDocumentRef *outDocumentRefsArray );

    Parameters

    inIndex

    The index containing the document information.

    inCount

    The number of document IDs in inDocumentIDsArray.

    inDocumentIDsArray

    Points to an array of document IDs corresponding to the document URL objects (of type SKDocumentRef) you want.

    outDocumentRefsArray

    On input, a pointer to an array for document URL objects. On output, points to the previously allocated array, which now contains document URL objects corresponding to the document IDs in inDocumentIDsArray.

    When finished with the document URL objects array, dispose of it by calling CFRelease on each array element.

    Discussion

    The SKIndexCopyDocumentRefsForDocumentIDs function lets you get a batch of document URL objects (of type SKDocumentRef) in one step, based on a list of document IDs.

    If you want to get lightweight URLs in the form of CFURL objects instead, use SKIndexCopyDocumentURLsForDocumentIDs.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Gets document URLs based on document IDs.

    Declaration

    Swift

    func SKIndexCopyDocumentURLsForDocumentIDs(_ inIndex: SKIndex!, _ inCount: CFIndex, _ inDocumentIDsArray: UnsafeMutablePointer<SKDocumentID>, _ outDocumentURLsArray: UnsafeMutablePointer<Unmanaged<CFURL>?>)

    Objective-C

    void SKIndexCopyDocumentURLsForDocumentIDs ( SKIndexRef inIndex, CFIndex inCount, SKDocumentID *inDocumentIDsArray, CFURLRef *outDocumentURLsArray );

    Parameters

    inIndex

    The index containing the document information.

    inCount

    The number of document IDs in inDocumentIDsArray.

    inDocumentIDsArray

    Points to an array of document IDs corresponding to the document URLs (CFURL objects) you want.

    outDocumentURLsArray

    On input, a pointer to an array for document URLs (CFURL objects). On output, points to the previously allocated array, which now contains document URLs corresponding to the document IDs in inDocumentIDArray.

    When finished with the document URL array, dispose of it by calling CFRelease on each array element.

    Discussion

    The SKIndexCopyDocumentURLsForDocumentIDs function lets you get a batch of document URLs (CFURL objects) in one step, based on a list of document IDs.

    If you want to get Search Kit Document URL objects (SKDocumentRefs) instead, use SKIndexCopyDocumentRefsForDocumentIDs.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Obtains document IDs for documents that contain a given term.

    Declaration

    Swift

    func SKIndexCopyDocumentIDArrayForTermID(_ inIndex: SKIndex!, _ inTermID: CFIndex) -> Unmanaged<CFArray>!

    Objective-C

    CFArrayRef SKIndexCopyDocumentIDArrayForTermID ( SKIndexRef inIndex, CFIndex inTermID );

    Parameters

    inIndex

    The index to search.

    inTermID

    The ID of the term to search for.

    Return Value

    An array of CFNumbers, each the ID for a document URL object that points to a document containing the search term.

    Discussion

    SKIndexCopyDocumentIDArrayForTermID searches a single index for documents that contain a given term. The search uses a term ID, not a term string. To get the ID of a term, use SKIndexGetTermIDForTermString.

    Term IDs are index-specific; that is, a term has a different ID in each index in which it appears. If you want to search for all the documents containing a term in a set of indexes, call this function in turn for each index, using the index-specific term ID in each case.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Obtains the IDs for the terms of an indexed document.

    Declaration

    Swift

    func SKIndexCopyTermIDArrayForDocumentID(_ inIndex: SKIndex!, _ inDocumentID: SKDocumentID) -> Unmanaged<CFArray>!

    Objective-C

    CFArrayRef SKIndexCopyTermIDArrayForDocumentID ( SKIndexRef inIndex, SKDocumentID inDocumentID );

    Parameters

    inIndex

    The index containing the document URL object (SKDocumentRef) and associated textual content.

    inDocumentID

    The ID of the document whose term IDs you are copying.

    Return Value

    A CFArray containing CFNumbers, each of which represents the ID for a term in a document.

    Discussion

    To derive the list of terms contained in a document, use this function to obtain an array of the term IDs, then convert each ID into the corresponding term with the SKIndexCopyTermStringForTermID function.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Obtains a term, specified by ID, from an index.

    Declaration

    Swift

    func SKIndexCopyTermStringForTermID(_ inIndex: SKIndex!, _ inTermID: CFIndex) -> Unmanaged<CFString>!

    Objective-C

    CFStringRef SKIndexCopyTermStringForTermID ( SKIndexRef inIndex, CFIndex inTermID );

    Parameters

    inIndex

    The index whose terms you are searching.

    inTermID

    The ID of the term whose string you want.

    Return Value

    A CFString containing the term specified by inTermID.

    Discussion

    When your application has the ID of a term, perhaps as a result of calling SKIndexCopyTermIDArrayForDocumentID, use this function to derive the term’s text string.

    To perform the inverse operation of deriving a term ID from a term string in a given index, use SKIndexGetTermIDForTermString.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets the ID for a term in an index.

    Declaration

    Swift

    func SKIndexGetTermIDForTermString(_ inIndex: SKIndex!, _ inTermString: CFString!) -> CFIndex

    Objective-C

    CFIndex SKIndexGetTermIDForTermString ( SKIndexRef inIndex, CFStringRef inTermString );

    Parameters

    inIndex

    The index you want to examine.

    inTermString

    The term string whose corresponding ID you want.

    Return Value

    A CFIndex object containing the term ID for a given term in an index. If the term isn’t found, this function returns a value of kCFNotFound.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Sets the application-defined properties of a document URL object (of type SKDocumentRef).

    Declaration

    Swift

    func SKIndexSetDocumentProperties(_ inIndex: SKIndex!, _ inDocument: SKDocument!, _ inProperties: CFDictionary!)

    Objective-C

    void SKIndexSetDocumentProperties ( SKIndexRef inIndex, SKDocumentRef inDocument, CFDictionaryRef inProperties );

    Parameters

    inIndex

    An index containing the document URL object whose properties you want to set.

    inDocument

    The document URL object whose properties you want to set.

    inProperties

    A CFDictionary object containing the properties to apply to the document URL object.

    Discussion

    Search Kit document URL objects (of type SKDocumentRef) can have an optional, application-defined properties dictionary to hold any information you’d like to associate with the document represented by a document URL object—such as timestamp, keywords, and so on.

    Use SKIndexSetDocumentProperties to persistently set application-defined properties for a document URL object in an index. This function replaces a document URL object’s existing properties dictionary with the new one. To obtain a copy of a document URL object’s properties dictionary, use SKIndexCopyDocumentProperties.

    Special Considerations

    You must set any desired properties on a document URL object after adding the document URL object to an index. Adding a document URL object to an index clears the object’s preexisting properties.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Obtains the application-defined properties of an indexed document.

    Declaration

    Swift

    func SKIndexCopyDocumentProperties(_ inIndex: SKIndex!, _ inDocument: SKDocument!) -> Unmanaged<CFDictionary>!

    Objective-C

    CFDictionaryRef SKIndexCopyDocumentProperties ( SKIndexRef inIndex, SKDocumentRef inDocument );

    Parameters

    inIndex

    The index containing the document URL object whose properties you want to copy.

    inDocument

    The document URL object whose properties you want to copy.

    Return Value

    A CFDictionary object containing the document URL object’s (SKDocumentRef’s) properties, or NULL on failure.

    Discussion

    Search Kit document URL objects (of type SKDocumentRef) can have an optional, application-defined properties dictionary to hold any information you’d like to associate with the document represented by a document URL object—such as timestamp, keywords, and so on. Use SKIndexSetDocumentProperties to add a properties dictionary to a document URL object, and this function to obtain a copy of the dictionary.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets the current indexing state of a document URL object (of type SKDocumentRef) in an index.

    Declaration

    Swift

    func SKIndexGetDocumentState(_ inIndex: SKIndex!, _ inDocument: SKDocument!) -> SKDocumentIndexState

    Objective-C

    SKDocumentIndexState SKIndexGetDocumentState ( SKIndexRef inIndex, SKDocumentRef inDocument );

    Parameters

    inIndex

    The index containing the document URL object whose indexing state you want.

    inDocument

    The document URL object whose indexing state you want.

    Return Value

    A value indicating the document URL object’s indexing state.

    Discussion

    A document URL object (of type SKDocumentRef) can be in one of four states, as defined by the “SKDocumentIndexState” enumeration: not indexed, indexed, not in the index but will be added after the index is flushed or closed, and in the index but will be deleted after the index is flushed or closed.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets the number of terms for a document in an index.

    Declaration

    Swift

    func SKIndexGetDocumentTermCount(_ inIndex: SKIndex!, _ inDocumentID: SKDocumentID) -> CFIndex

    Objective-C

    CFIndex SKIndexGetDocumentTermCount ( SKIndexRef inIndex, SKDocumentID inDocumentID );

    Parameters

    inIndex

    The index containing the text of the document whose term count you want.

    inDocumentID

    The ID of the document URL object whose term count you want. Obtain a document ID by calling SKIndexGetDocumentID.

    Return Value

    A CFIndex object containing the number of terms in a document.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets the number of occurrences of a term in a document.

    Declaration

    Swift

    func SKIndexGetDocumentTermFrequency(_ inIndex: SKIndex!, _ inDocumentID: SKDocumentID, _ inTermID: CFIndex) -> CFIndex

    Objective-C

    CFIndex SKIndexGetDocumentTermFrequency ( SKIndexRef inIndex, SKDocumentID inDocumentID, CFIndex inTermID );

    Parameters

    inIndex

    The index containing the text of the document whose term count you are interested in.

    inDocumentID

    The ID of the document URL object whose associated term count you are interested in. Obtain a document ID by calling SKIndexGetDocumentID.

    inTermID

    The ID of the term whose number of occurrences you want.

    Return Value

    A CFIndex object containing the number of occurrences of a term in a document.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets the number of documents containing a given term represented in an index.

    Declaration

    Swift

    func SKIndexGetTermDocumentCount(_ inIndex: SKIndex!, _ inTermID: CFIndex) -> CFIndex

    Objective-C

    CFIndex SKIndexGetTermDocumentCount ( SKIndexRef inIndex, CFIndex inTermID );

    Parameters

    inIndex

    The index containing the text of the documents you want to examine.

    inTermID

    The terms whose occurrences you want to know.

    Return Value

    A CFIndex object containing the number of documents represented in an index that contain a given term.

    Discussion

    If you want to know in which documents a term appears across multiple indexes, call this function separately on each index. Before querying each index, get the index-specific term ID using SKIndexGetTermIDForTermString.

    To ensure that this function takes into account document URL objects (of type SKDocumentRef) recently added to indexes, call SKIndexFlush on each index before calling this function.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Gets the ID of a document URL object (of type SKDocumentRef) in an index.

    Declaration

    Swift

    func SKIndexGetDocumentID(_ inIndex: SKIndex!, _ inDocument: SKDocument!) -> SKDocumentID

    Objective-C

    SKDocumentID SKIndexGetDocumentID ( SKIndexRef inIndex, SKDocumentRef inDocument );

    Parameters

    inIndex

    The index containing the text of the document whose document URL object ID you want.

    inDocument

    The document URL object whose ID you want.

    Return Value

    A document ID object.

    Discussion

    The document ID identifies a document URL object (of type SKDocumentRef) in an index. The ID is available as soon as you add a document URL object to an index using SKIndexAddDocumentWithText or SKIndexAddDocument.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Creates an asynchronous search object for querying an index, and initiates search.

    Declaration

    Swift

    func SKSearchCreate(_ inIndex: SKIndex!, _ inQuery: CFString!, _ inSearchOptions: SKSearchOptions) -> Unmanaged<SKSearch>!

    Objective-C

    SKSearchRef SKSearchCreate ( SKIndexRef inIndex, CFStringRef inQuery, SKSearchOptions inSearchOptions );

    Parameters

    inIndex

    The index to query.

    inQuery

    The query string to search for.

    inSearchOptions

    The search options. May be NULL. See the “SKSearchOptions” enumeration for a description of the available options.

    Return Value

    A search object.

    Discussion

    This function creates an asynchronous search object for querying the document contents in an index. It also initiates the search on a separate thread.

    After you create the search object, call SKSearchFindMatches to retrieve results. You can call SKSearchFindMatches immediately. To cancel a search, call SKSearchCancel.

    For normal (non-similarity-based) queries, Search Kit discerns the type of query—Boolean, prefix, phrase, and so on—from the syntax of the query itself. Moreover, Search Kit supports multiple query types within a single search. For example, the following query includes Boolean, prefix, and suffix searching:

    • appl* OR *ing

    This query will return documents containing words that begin with “appl” as well as documents that contain words that end with “ing”.

    For similarity searches, specified with the kSKSearchOptionFindSimilar flag in the inSearchOptions parameter, SKSearchCreate ignores all query operators.

    The query operators that SKSearchCreate recognizes for non-similarity searching are:

    Table 1Search Kit query operators for non-similarity searches

    Operator

    meaning

    AND

    Boolean AND

    &

    Boolean AND

    <space>

    Boolean AND by default when no other operator is present, or Boolean OR if specified by kSKSearchOptionSpaceMeansOR.

    OR

    Boolean inclusive OR

    |

    Boolean inclusive OR

    NOT

    Boolean NOT (see Special Considerations)

    !

    Boolean NOT (see Special Considerations)

    *

    Wildcard for prefix or suffix; surround term with wildcard characters for substring search. Ignored in phrase searching.

    (

    Begin logical grouping

    )

    End logical grouping

    "

    delimiter for phrase searching

    The operators AND, OR, and NOT are case sensitive.

    Search Kit performs Unicode normalization on query strings and on the text placed into indexes. It uses Unicode Normalization Form KC (NFKC, compatibility decomposition followed by canonical composition) as documented in Unicode Standard Annex #15. For example, the a-grave character, ‘à’, can be written as the two Unicode characters (0x0061, 0x0300) or as the single Unicode character 0x00E0. Search Kit will normalize (0x0061, 0x0300) to 0x00E0. For more information on Unicode normalization, see http://unicode.org/reports/tr15 .

    Search Kit further normalizes query strings and indexes by stripping diacritical marks and by forcing characters to lowercase. For example, Search Kit normalizes each of the following characters to ‘a’: ‘a’, ‘à’, ‘A’, and ‘À’.

    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.

    When your application no longer needs the search object, dispose of it by calling CFRelease.

    Special Considerations

    Search Kit supports logical exclusion. The NOT and ! operators behave as though they were EXCLUDE operators. For example, a search for ‘red NOT blue’ returns all documents that contain the word ‘red’ and do not contain the word ‘blue’.

    Unary Boolean operators, however, are not currently implemented in Search Kit. A search, for example, for ‘NOT blue’, returns zero documents no matter what their content.

    You cannot use CFMakeCollectable with SKSearch objects. In a garbage-collected environment, you must use CFRelease to dispose of an SKSearch object.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Extracts search result information from a search object.

    Declaration

    Swift

    func SKSearchFindMatches(_ inSearch: SKSearch!, _ inMaximumCount: CFIndex, _ outDocumentIDsArray: UnsafeMutablePointer<SKDocumentID>, _ outScoresArray: UnsafeMutablePointer<Float>, _ maximumTime: CFTimeInterval, _ outFoundCount: UnsafeMutablePointer<CFIndex>) -> Boolean

    Objective-C

    Boolean SKSearchFindMatches ( SKSearchRef inSearch, CFIndex inMaximumCount, SKDocumentID *outDocumentIDsArray, float *outScoresArray, CFTimeInterval maximumTime, CFIndex *outFoundCount );

    Parameters

    inSearch

    A reference to a search object (SKSearchRef) previously created with SKSearchCreate.

    inMaximumCount

    The maximum number of items to find. For each item found, SKSearchFindMatches places the associated document ID into the outDocumentIDsArray array. Specify an inMaximumCount of 0 to find as many items as possible within maximumTime.

    outDocumentIDsArray

    On input, a pointer to an array for document IDs. On output, points to points to the previously allocated array, which now contains the found document IDs. The size of this array must be equal to inMaximumCount.

    outScoresArray

    On input, a pointer to an array for scores. On output, points to the previously allocated array, which now contains relevance scores for the found items. The size of this array, if not NULL, must be equal to inMaximumCount. Can be NULL on input, provided that your application doesn’t need this information. Search Kit does not normalize relevance scores, so they can be very large.

    maximumTime

    The maximum number of seconds before this function returns, whether or not inMaximumCount items have been found. Setting maximumTime to 0 tells the search to return quickly

    outFoundCount

    On input, a pointer to a CFIndex object that will hold the number of items found. On output, points to the CFIndex object that now contains the actual number of items found.

    Return Value

    A logical value indicating whether the search is still in progress. Returns false when the search is exhausted.

    Discussion

    The SKSearchFindMatches extracts results from a find operation initiated by a search object (SKSearchRef).

    This function provides results to its output parameters simply in the order in which they are found. This reduces latency to support search-as-you-type functionality. Larger scores mean greater relevance.

    You can call this function on a search object repeatedly to get additional sets of search results. For example, if you call this function twice with an inMaximumCount value of 10, the first call will put the first 10 items found into the output arrays and the second call will put the second 10 items found into the output arrays.

    Applications are free to display relevance scores in any appropriate manner. One simple way is to divide each relevance score by the largest number returned to get relevance numbers scaled linearly from 0.0 to 1.0. Search Kit does not scale the relevance scores for you, because you may want to combine the scores from several calls on a search object or the scores from calls to more than one search object.

    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.

    Before invoking a search, call SKIndexFlush on all indexes you will query to ensure that updates to the indexes have been flushed to disk.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Cancels an asynchronous search request.

    Declaration

    Swift

    func SKSearchCancel(_ inSearch: SKSearch!)

    Objective-C

    void SKSearchCancel ( SKSearchRef inSearch );

    Parameters

    inSearch

    The search object whose associated asynchronous search you want to cancel.

    Discussion

    Call this function when you want to cancel an asynchronous search that you initiated with SKSearchCreate. This function stops the search process if it is still in progress at the time. It does not dispose of the search object (SKSearchRef).

    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.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Gets the type identifier for Search Kit search objects.

    Declaration

    Swift

    func SKSearchGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID SKSearchGetTypeID ( void );

    Return Value

    A CFTypeID object containing the type identifier for the SKSearch opaque type.

    Discussion

    Search Kit represents searches with search objects (SKSearchRef opaque types). If your code needs to determine whether a particular data type is a search object, you can use this function along with the CFGetTypeID function and perform a comparison.

    Never hard-code the search type ID because it can change from one release of OS X to another.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

Search Kit’s Summarization functions supplant those in Apple’s Find by Content API.

  • Creates a summary object based on a text string.

    Declaration

    Swift

    func SKSummaryCreateWithString(_ inString: CFString!) -> Unmanaged<SKSummary>!

    Objective-C

    SKSummaryRef SKSummaryCreateWithString ( CFStringRef inString );

    Parameters

    inString

    The text string that you want to summarize.

    Return Value

    Returns a summarization object, or NULL on failure.

    Discussion

    The SKSummaryCreateWithString function creates a summarization object that pre-analyzes a text string to support fast summarization. When your application no longer needs the summarization object, dispose of it by calling CFRelease.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Gets detailed information about a body of text for constructing a custom sentence-based summary string.

    Declaration

    Swift

    func SKSummaryGetSentenceSummaryInfo(_ summary: SKSummary!, _ numSentencesInSummary: CFIndex, _ outRankOrderOfSentences: UnsafeMutablePointer<CFIndex>, _ outSentenceIndexOfSentences: UnsafeMutablePointer<CFIndex>, _ outParagraphIndexOfSentences: UnsafeMutablePointer<CFIndex>) -> CFIndex

    Objective-C

    CFIndex SKSummaryGetSentenceSummaryInfo ( SKSummaryRef summary, CFIndex numSentencesInSummary, CFIndex *outRankOrderOfSentences, CFIndex *outSentenceIndexOfSentences, CFIndex *outParagraphIndexOfSentences );

    Parameters

    summary

    The summarization object containing the text from which you want to build a summary.

    numSentencesInSummary

    The maximum number of sentences you want in the summary.

    outRankOrderOfSentences

    On input, a pointer to an array of CFIndex objects. On output, points to the previously allocated array, which now lists the summarization relevance rank of each sentence in the original text. The most important sentence gets a rank of 1. The array size must equal numSentencesInSummary, or else be NULL if you don’t want to get the rank orders.

    outSentenceIndexOfSentences

    On input, a pointer to an array of CFIndex objects. On output, points to the previously allocated array, which now contains the ordinal number for each sentence in the original text. Use the SKSummaryCopySentenceAtIndex function with one of these numbers to get the corresponding sentence. The array size must equal numSentencesInSummary, or else be NULL if you don’t want to get the ordinal numbers of the sentences.

    outParagraphIndexOfSentences

    On input, a pointer to an array of CFIndex objects. On output, points to the previously allocated array, which now contains the ordinal number for the paragraph that each corresponding sentence, referenced in outSentenceIndexOfSentences, appears in. The array size must equal numSentencesInSummary, or else be NULL if you don’t want to get the ordinal numbers of the sentences.

    Return Value

    The number of sentences in the summary.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Gets detailed information about a body of text for constructing a custom paragraph-based summary string.

    Declaration

    Swift

    func SKSummaryGetParagraphSummaryInfo(_ summary: SKSummary!, _ numParagraphsInSummary: CFIndex, _ outRankOrderOfParagraphs: UnsafeMutablePointer<CFIndex>, _ outParagraphIndexOfParagraphs: UnsafeMutablePointer<CFIndex>) -> CFIndex

    Objective-C

    CFIndex SKSummaryGetParagraphSummaryInfo ( SKSummaryRef summary, CFIndex numParagraphsInSummary, CFIndex *outRankOrderOfParagraphs, CFIndex *outParagraphIndexOfParagraphs );

    Parameters

    summary

    The summarization object containing the text from which you want to build a summary.

    numParagraphsInSummary

    The maximum number of paragraphs you want in the summary.

    outRankOrderOfParagraphs

    On input, a pointer to an array of CFIndex objects. On output, points to the previously allocated array, which now lists the summarization relevance rank of each paragraph in the original text. The most important paragraph gets a rank of 1. The array size must equal numParagraphsInSummary, or else be NULL if you don’t want to get the relevance ranks.

    outParagraphIndexOfParagraphs

    On output, points to an array containing the ordinal number for each paragraph in the original text. Use the SKSummaryCopyParagraphAtIndex function with one of these numbers to get the corresponding paragraph. The array size must equal numParagraphsInSummary, or else be NULL if you don’t want to get the ordinal numbers of the paragraphs.

    Return Value

    The number of paragraphs in the summary.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Gets the number of sentences in a summarization object.

    Declaration

    Swift

    func SKSummaryGetSentenceCount(_ summary: SKSummary!) -> CFIndex

    Objective-C

    CFIndex SKSummaryGetSentenceCount ( SKSummaryRef summary );

    Parameters

    summary

    The summarization object whose sentences you want to count.

    Return Value

    A CFIndex object containing the number of sentences in the summarization object.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Gets the number of paragraphs in a summarization object.

    Declaration

    Swift

    func SKSummaryGetParagraphCount(_ summary: SKSummary!) -> CFIndex

    Objective-C

    CFIndex SKSummaryGetParagraphCount ( SKSummaryRef summary );

    Parameters

    summary

    The summarization object whose paragraphs you want to count.

    Return Value

    A CFIndex object containing the number of paragraphs in the summarization object.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Gets a specified sentence from the text in a summarization object.

    Declaration

    Swift

    func SKSummaryCopySentenceAtIndex(_ summary: SKSummary!, _ i: CFIndex) -> Unmanaged<CFString>!

    Objective-C

    CFStringRef SKSummaryCopySentenceAtIndex ( SKSummaryRef summary, CFIndex i );

    Parameters

    summary

    The summarization object containing the text from which you want a sentence.

    i

    The ordinal number of the sentence in the original text, with the first sentence designated by zero (this function uses zero-based indexing).

    Return Value

    A CFStringRef object containing the specified sentence, or NULL on failure.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Gets a specified paragraph from the text in a summarization object.

    Declaration

    Swift

    func SKSummaryCopyParagraphAtIndex(_ summary: SKSummary!, _ i: CFIndex) -> Unmanaged<CFString>!

    Objective-C

    CFStringRef SKSummaryCopyParagraphAtIndex ( SKSummaryRef summary, CFIndex i );

    Parameters

    summary

    The summarization object containing the text from which you want a paragraph.

    i

    The ordinal number of the paragraph in the original text, with the first paragraph designated by zero (this function uses zero-based indexing).

    Return Value

    A CFStringRef object containing the specified paragraph, or NULL on failure.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Gets a text string consisting of a summary with, at most, the requested number of sentences.

    Declaration

    Swift

    func SKSummaryCopySentenceSummaryString(_ summary: SKSummary!, _ numSentences: CFIndex) -> Unmanaged<CFString>!

    Objective-C

    CFStringRef SKSummaryCopySentenceSummaryString ( SKSummaryRef summary, CFIndex numSentences );

    Parameters

    summary

    The summarization object containing the text from which you want a summarization.

    numSentences

    The maximum number of sentences you want in the summary.

    Return Value

    A CFStringRef object containing the requested summary.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Gets a text string consisting of a summary with, at most, the requested number of paragraphs.

    Declaration

    Swift

    func SKSummaryCopyParagraphSummaryString(_ summary: SKSummary!, _ numParagraphs: CFIndex) -> Unmanaged<CFString>!

    Objective-C

    CFStringRef SKSummaryCopyParagraphSummaryString ( SKSummaryRef summary, CFIndex numParagraphs );

    Parameters

    summary

    The summarization object containing the text from which you want a summarization.

    numParagraphs

    The maximum number of paragraphs you want in the summary.

    Return Value

    A CFStringRef object containing the requested summary.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Gets the type identifier for Search Kit summarization objects.

    Declaration

    Swift

    func SKSummaryGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID SKSummaryGetTypeID ( void );

    Return Value

    A CFTypeID object, or NULL on failure.

    Discussion

    Search Kit represents summarization results with summarization objects (SKSummaryRef opaque types). If your code needs to determine whether a particular data type is a summary, you can use this function along with the CFGetTypeID function and perform a comparison.

    Never hard-code the summarization type ID because it can change from one release of OS X to another.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

Developers should avoid using the functions listed in this section; instead, use the replacement functions that are recommended. Search Kit retains the functions in this section for backward compatibility.

  • Creates a search group as an array of references to indexes.

    Deprecation Statement

    Use asynchronous searching with SKSearchCreate instead, which does not employ search groups.

    Declaration

    Objective-C

    SKSearchGroupRef SKSearchGroupCreate ( CFArrayRef inArrayOfInIndexes );

    Parameters

    inArrayOfInIndexes

    A CFArray object containing the indexes to put into the search group.

    Return Value

    An SKSearchGroup opaque type.

    Discussion

    Creates a search group as an array of references to indexes.

    You create a search group to search one or more indexes, and then typically use the resulting SKSearchGroupRef opaque type with SKSearchResultsCreateWithQuery or SKSearchResultsCreateWithDocuments.

    When your application no longer needs the search group, dispose of it by calling CFRelease.

    Import Statement

    Objective-C

    @import CoreServices;

    Availability

    Available in OS X v10.3 and later.

    Deprecated in OS X v10.4.

  • Obtains the indexes for a search group.

    Deprecation Statement

    Use asynchronous searching with SKSearchCreate instead, which does not employ search groups.

    Declaration

    Objective-C

    CFArrayRef SKSearchGroupCopyIndexes ( SKSearchGroupRef inSearchGroup );

    Parameters

    inSearchGroup

    The search group whose indexes you want to copy.

    Return Value

    A CFArray object containing the indexes in the search group.

    Discussion

    Although the search functions SKSearchResultsCreateWithQuery and SKSearchResultsCreateWithDocuments operate directly on search groups, many Search Kit functions, such as SKIndexCompact, operate on one index at a time. When you want to examine or manage all the indexes in a search group, use SKSearchGroupCopyIndexes to get the search group’s list of indexes.

    Import Statement

    Objective-C

    @import CoreServices;

    Availability

    Available in OS X v10.3 and later.

    Deprecated in OS X v10.4.

  • Deprecated. Use asynchronous searching with SKSearchCreate instead, which does not employ search groups.

    Declaration

    Objective-C

    CFTypeID SKSearchGroupGetTypeID ( void );

    Return Value

    A CFTypeID object containing the type identifier for the SKSearchGroup opaque type.

    Discussion

    Gets the type identifier for Search Kit search groups.

    Search Kit represents search groups with the SKSearchGroupRef opaque type. If your code needs to determine whether a particular data type is a search group, you can use this function along with the CFGetTypeID function and perform a comparison.

    Never hard-code the search group type ID because it can change from one release of OS X to another.

    Import Statement

    Objective-C

    @import CoreServices;

    Availability

    Available in OS X v10.3 and later.

    Deprecated in OS X v10.4.

  • Finds documents similar to given example documents.

    Deprecation Statement

    Use SKSearchCreate instead.

    Declaration

    Objective-C

    SKSearchResultsRef SKSearchResultsCreateWithDocuments ( SKSearchGroupRef inSearchGroup, CFArrayRef inExampleDocuments, CFIndex inMaxFoundDocuments, void *inContext, SKSearchResultsFilterCallBack inFilterCallBack );

    Parameters

    inSearchGroup

    A search group containing the indexes which, in turn, contain the document URL objects (SKDocumentRefs) representing the documents you want to search by similarity. The search group must also contains the indexes that contain the textual content of the example documents.

    inExampleDocuments

    An array of document URL objects (SKDocumentRefs), each representing an example document.

    inMaxFoundDocuments

    The maximum number of found items to return. Your application must pass in a positive value.

    inContext

    An application-specified context for use by the SKSearchResultsFilterCallBack callback function. Can be NULL.

    inFilterCallBack

    A callback function for hit testing during searching—see SKSearchResultsFilterCallBack. In a similarity search, your application would typically use this function to exclude the example documents from the search results. This parameter can be NULL, in which case your application receives the returned results directly and without any custom postprocessing.

    Return Value

    A search results object containing a list of document URL objects (SKDocumentRefs) representing documents similar to the example documents.

    Discussion

    This function searches the on-disk indexes in a search group for document URL objects (SKDocumentRefs) representing documents similar to those provided as examples. Build the search group in three steps:

    1. Collect the index IDs from the search groups you want to search: for each search group, call the SKSearchGroupCopyIndexes function.

    2. Add the document URL objects representing the example documents to a memory-based index (if they’re not already in an index) by calling SKIndexCreateWithMutableData, and get that index’s ID.

    3. Create a new search group that contains the indexes to search, and also containing the example-documents index, using SKSearchGroupCreate.

    Before invoking a search, call SKIndexFlush on all indexes in the search group to ensure that changes to the indexes have been written to disk.

    Once you’ve obtained the results of a search, get the specifics—including which documents match the user’s similarity query, and the ranking scores for each document—by calling SKSearchResultsGetInfoInRange.

    When your application no longer needs the search result, dispose of it by calling CFRelease.

    Import Statement

    Objective-C

    @import CoreServices;

    Availability

    Available in OS X v10.3 and later.

    Deprecated in OS X v10.4.

  • Extracts information from a Search Kit query result.

    Deprecation Statement

    Use SKSearchCreate instead.

    Declaration

    Objective-C

    CFIndex SKSearchResultsGetInfoInRange ( SKSearchResultsRef inSearchResults, CFRange inRange, SKDocumentRef *outDocumentsArray, SKIndexRef *outIndexesArray, float *outScoresArray );

    Parameters

    inSearchResults

    The search results whose information you want to extract.

    inRange

    The starting ranking and total number of found items to obtain, specified as (Location, Length). ‘Location’ specifies the starting item by ranking, with the top-ranked item having a location of 0. ‘Length’ specifies the total number of items to include in the results. For example, (0,1) indicates the first item, which is also the highest-ranking item. (1,1) indicates the second item, which is also the second-highest-ranking item. (0,5) means to get the first 5 items.

    outDocumentsArray

    On output, points to an array of found document URL objects (SKDocumentRefs).

    outIndexesArray

    On output, points to an array of indexes in which the found document URL objects reside. Can be NULL on input, provided that your application doesn’t need this information.

    outScoresArray

    On output, points to an array of correspondence scores for found items. Can be NULL on input, provided that your application doesn’t need this information.

    Return Value

    The number of items returned—usually the same number as specified by the length item in the inRange parameter.

    Discussion

    This function provides results to its output parameters in the order in which they are found, to reduce latency and to support search-as-you-type functionality.

    Import Statement

    Objective-C

    @import CoreServices;

    Availability

    Available in OS X v10.3 and later.

    Deprecated in OS X v10.4.

  • Obtains the terms in a document that match a query.

    Deprecation Statement

    Use SKSearchCreate instead.

    Declaration

    Objective-C

    CFArrayRef SKSearchResultsCopyMatchingTerms ( SKSearchResultsRef inSearchResults, CFIndex inItem );

    Parameters

    inSearchResults

    The search results to examine.

    inItem

    An integer that corresponds to a document URL object (SKDocumentRef) in the search results. A value of ‘1’ identifies the first document URL object in the search results, a value of ‘2’ identifies the second, and so on.

    If you’ve created the search results using SKSearchResultsCreateWithQuery, the document URL objects are sorted in ranking order with the top-ranked one first. See SKSearchResultsGetInfoInRange for a description of how to get a particular document URL object, or set of them, from a search result.

    Return Value

    A CFArray object containing term IDs.

    Discussion

    When using a prefix search, or a search for which the user entered more than one word, there may be multiple terms that match the query. This function returns an array of the term IDs corresponding to these matches.

    For example, a user could enter ‘App’ when performing a prefix search. If a document represented in the search group contains the words ‘Apple,’ ‘application,’ and ‘appendectomy,’ the IDs for all of these terms would then appear in the CFArray object that SKSearchResultsCopyMatchingTerms returns.

    See SKSearchResultsCreateWithQuery for a description of how to perform a search and get search results. See SKSearchResultsGetInfoInRange for how to extract information, including document URL objects, from a search result. See “Deprecated Search Keys” for a description of the various categories of search.

    Import Statement

    Objective-C

    @import CoreServices;

    Availability

    Available in OS X v10.3 and later.

    Deprecated in OS X v10.4.

  • Gets the total number of found items in a search.

    Deprecation Statement

    Use SKSearchCreate instead.

    Declaration

    Objective-C

    CFIndex SKSearchResultsGetCount ( SKSearchResultsRef inSearchResults );

    Parameters

    inSearchResults

    A search results object containing the results of a query.

    Return Value

    A CFIndex object containing the total number of found items in a search.

    Import Statement

    Objective-C

    @import CoreServices;

    Availability

    Available in OS X v10.3 and later.

    Deprecated in OS X v10.4.

  • Gets the type identifier for Search Kit search results.

    Deprecation Statement

    Use SKSearchCreate instead.

    Declaration

    Objective-C

    CFTypeID SKSearchResultsGetTypeID ( void );

    Return Value

    A CFTypeID object containing the type identifier for the SKSearchResults opaque type.

    Discussion

    Search Kit represents search results with search results objects (SKSearchResultsRef opaque types). If your code needs to determine whether a particular data type is a search result, you can use this function along with the CFGetTypeID function and perform a comparison.

    Never hard-code the search result type ID because it can change from one release of OS X to another.

    Import Statement

    Objective-C

    @import CoreServices;

    Availability

    Available in OS X v10.3 and later.

    Deprecated in OS X v10.4.

  • Queries the indexes in a search group.

    Deprecation Statement

    Use SKSearchCreate instead.

    Declaration

    Objective-C

    SKSearchResultsRef SKSearchResultsCreateWithQuery ( SKSearchGroupRef inSearchGroup, CFStringRef inQuery, SKSearchType inSearchType, CFIndex inMaxFoundDocuments, void *inContext, SKSearchResultsFilterCallBack inFilterCallBack );

    Parameters

    inSearchGroup

    The search group to query.

    inQuery

    The query string to search for.

    inSearchType

    The category of search to perform. See the “Deprecated Search Keys” enumeration for options.

    inMaxFoundDocuments

    The maximum number of found items to return. Your application must pass in a positive integer value.

    inContext

    An application-specified context for use by the SKSearchResultsFilterCallBack. Can be NULL, but if you want to use the callback you must supply a context.

    inFilterCallBack

    A callback function for hit testing during searching. Can be NULL, in which case your application receives the returned results directly and without any custom postprocessing. If non-NULL, you must supply a context. See SKSearchResultsFilterCallBack.

    Return Value

    A search results object.

    Discussion

    This function searches the on-disk indexes in a search group. Before invoking a search, call SKIndexFlush on all indexes in the search group to ensure that changes to the indexes have been flushed to disk.

    Once you’ve obtained the results of a search, get the specifics—including which documents match the user’s query, and the ranking scores for each document—by calling SKSearchResultsGetInfoInRange. You can extract other information by calling SKSearchResultsCopyMatchingTerms and SKSearchResultsGetCount.

    When your application no longer needs the search result, dispose of it by calling CFRelease.

    Special Considerations

    This deprecated function performs searches synchronously. Apple recommends using the asynchronous SKSearchCreate function instead.

    In the current implementation of Search Kit, unary Boolean operators are not implemented. A search, for example, for ‘not blue’, returns zero documents no matter what their content.

    Import Statement

    Objective-C

    @import CoreServices;

    Availability

    Available in OS X v10.3 and later.

    Deprecated in OS X v10.4.

Callbacks

  • Deprecated. Use SKSearchCreate and SKSearchFindMatches instead, which do not use a callback.

    Declaration

    Swift

    typealias SKSearchResultsFilterCallBack = CFunctionPointer<((SKIndex!, SKDocument!, UnsafeMutablePointer<Void>) -> Boolean)>

    Objective-C

    typedef Boolean (SKSearchResultsFilterCallBack) ( SKIndexRef inIndex, SKDocumentRef inDocument, void *inContext

    Parameters

    inIndex

    The index you are searching.

    inDocument

    The document URL object within the index you are searching.

    inContext

    An application-specified context which you set when calling SKSearchResultsCreateWithQuery or SKSearchResultsCreateWithDocuments.

    Return Value

    A Boolean value of true for a successful search hit, or false otherwise.

    Discussion

    Deprecated. Defines a pointer to a search-results filtering callback function for hit testing and processing during a search. Use this callback function to perform custom filtering on the search hits returned by the SKSearchResultsCreateWithQuery and SKSearchResultsCreateWithDocuments functions. Return true to keep this document URL object (SKDocumentRef) in the results, false to filter it out.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

Data Types

  • Defines an opaque data type representing a document’s URL.

    Declaration

    Swift

    typealias SKDocumentRef = SKDocument

    Objective-C

    typedef struct __SKDocument *SKDocumentRef;

    Discussion

    A document URL object is a generic location specification for a document. It is built from a document scheme, a parent document, and a document name. You can convert back and forth between document URL objects and CFURL objects using Search Kit’s SKDocumentCreateWithURL and SKDocumentCopyURL functions.

    To create a Search Kit document URL object, use SKDocumentCreateWithURL when you can provide a complete URL, or use SKDocumentCreate when you want to specify document location indirectly using a parent document URL object. For other operations on documents, see Working with Documents and Terms.

    If you create document URL objects with indirect locations using the SKDocumentCreate function, you can resolve the locations by assembling them piece by piece, starting with a document URL object and going up step by step, parent to parent.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Defines an opaque data type representing an index-based document iterator.

    Declaration

    Swift

    typealias SKIndexDocumentIteratorRef = SKIndexDocumentIterator

    Objective-C

    typedef struct __SKIndexDocumentIterator *SKIndexDocumentIteratorRef;

    Discussion

    A Search Kit document iterator lets your application loop through all the document URL objects owned by a given parent document URL object. To create an iterator, use SKIndexDocumentIteratorCreate. To get a copy of the next document in the set owned by the iterator, use SKIndexDocumentIteratorCopyNext.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Defines an opaque data type representing an index.

    Declaration

    Swift

    typealias SKIndexRef = SKIndex

    Objective-C

    typedef struct __SKIndex *SKIndexRef;

    Discussion

    A Search Kit index object contains the textual contents of one or more documents, as well as document URL objects (SKDocumentRefs) representing those documents’ locations.

    To create a new disk-based Search Kit index object, use SKIndexCreateWithURL. To create a memory-based index, use SKIndexCreateWithMutableData. For other operations on indexes, see Creating, Opening, and Closing Indexes and Managing Indexes. Also seeFast Asynchronous Searching.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Defines an opaque data type representing a an asynchronous search.

    Declaration

    Swift

    typealias SKSearchRef = SKSearch

    Objective-C

    typedef struct __SKSearch *SKSearchRef;

    Discussion

    A search object is created when you call the SKSearchCreate function.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Defines an opaque data type representing summarization information.

    Declaration

    Swift

    typealias SKSummaryRef = SKSummary

    Objective-C

    typedef struct __SKSummary *SKSummaryRef;

    Discussion

    A summarization object contains summarization information, including summary text.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Defines an opaque data type representing a lightweight document identifier.

    Declaration

    Swift

    typealias SKDocumentID = CFIndex

    Objective-C

    typedef CFIndex SKDocumentID;

    Discussion

    Use document IDs rather than document URL objects (SKDocumentRefs) whenever possible. Using document IDs results in faster searching.

    You can work with document IDs using a variety of Search Kit functions. See SKIndexGetMaximumDocumentID, SKIndexCopyDocumentForDocumentID, SKIndexCopyInfoForDocumentIDs, SKIndexCopyDocumentRefsForDocumentIDs, SKIndexCopyDocumentURLsForDocumentIDs, SKIndexCopyDocumentIDArrayForTermID, and SKIndexCopyTermIDArrayForDocumentID.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Deprecated. Use asynchronous searching with SKSearchCreate instead, which does not employ search groups.

    Declaration

    Swift

    typealias SKSearchResultsRef = SKSearchResults

    Objective-C

    typedef struct __SKSearchResults *SKSearchResultsRef;

    Discussion

    Defines an opaque data type representing the result of a search. To perform a query and generate search results, use SKSearchResultsCreateWithQuery or SKSearchResultsCreateWithDocuments. To examine the result of a search, use SKSearchResultsGetInfoInRange. For other operations on search results, see Legacy Support for Synchronous Searching.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Deprecated. Use asynchronous searching with SKSearchCreate instead, which does not employ search groups.

    Declaration

    Swift

    typealias SKSearchGroupRef = SKSearchGroup

    Objective-C

    typedef struct __SKSearchGroup *SKSearchGroupRef;

    Discussion

    Defines an opaque data type representing a search group.

    A search group is a group of one or more indexes to be searched. To create a search group, use SKSearchGroupCreate. For other operations with search groups, see Fast Asynchronous Searching.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

Constants

  • Each of these constants is an optional key in a Search Kit index’s text analysis properties dictionary. The constant descriptions describe the corresponding values for each of these keys. These keys are declared in the Analysis.h header file.

    Declaration

    Swift

    let kSKMinTermLength: CFString! let kSKStopWords: CFString! let kSKSubstitutions: CFString! let kSKMaximumTerms: CFString! let kSKProximityIndexing: CFString! let kSKTermChars: CFString! let kSKStartTermChars: CFString! let kSKEndTermChars: CFString!

    Objective-C

    const CFStringRef kSKMinTermLength; const CFStringRef kSKStopWords; const CFStringRef kSKSubstitutions; const CFStringRef kSKMaximumTerms; const CFStringRef kSKProximityIndexing; const CFStringRef kSKTermChars; const CFStringRef kSKStartTermChars; const CFStringRef kSKEndTermChars;

    Constants

    • kSKMinTermLength

      kSKMinTermLength

      The minimum term length to index. Specified as a CFNumber object. If this optional key is not present, Search Kit indexing defaults to a minimum term length of 1.

      Available in OS X v10.3 and later.

    • kSKStopWords

      kSKStopWords

      A set of stopwords—words not to index. Specified as a CFSet object. There is no default stopword list. You must supply your own.

      Available in OS X v10.3 and later.

    • kSKSubstitutions

      kSKSubstitutions

      A dictionary of term substitutions—terms that differ in their character strings but that match during a search. Specified as a CFDictionary object.

      Available in OS X v10.3 and later.

    • kSKMaximumTerms

      kSKMaximumTerms

      The maximum number of number unique terms to index in each document. Specified as a CFNumber object.

      Search Kit indexes from the beginning of a document. When it has indexed the first n unique terms, it stops.

      The default number of maximum terms, which applies if you do not provide a number, is 2000.

      To tell Search Kit to index all the terms in each document without limit, specify a value of 0.

      Available in OS X v10.4 and later.

    • kSKProximityIndexing

      kSKProximityIndexing

      A Boolean flag indicating whether or not Search Kit should use proximity indexing. The flag can be a 0 or kCFBoolenFalse value (for false) or a 1 or kCFBooleanTrue value (for true). Proximity indexing is available only for inverted indexes—that is, indexes of type kSKIndexInverted.

      Use proximity indexing to support phrase searching. If this key is not present in an index’s text analysis properties dictionary, Search Kit defaults to not adding proximity information to the index.

      Available in OS X v10.4 and later.

    • kSKTermChars

      kSKTermChars

      Additional valid starting-position “word” characters for indexing and querying. The corresponding value, a CFString object, specifies the additional valid “word” characters that you want to be considered as valid starting characters of terms for indexing and querying. “Word” characters are contrasted with nonword characters, such as spaces.

      The value of kSKStartTermChars, if this key is present, overrides the value of kSKTermChars for the first character of a term.

      By default, Search Kit considers alphanumeric characters as valid starting characters for terms, and considers all others (including the underscore character) to be nonword characters.

      Available in OS X v10.4 and later.

    • kSKStartTermChars

      kSKStartTermChars

      Additional valid starting-position “word” characters for indexing and querying. The corresponding value, a CFString object, specifies the additional valid “word” characters that you want to be considered as valid starting characters of terms for indexing and querying. “Word” characters are contrasted with nonword characters, such as spaces.

      The value of kSKStartTermChars, if this key is present, overrides the value of kSKTermChars for the first character of a term.

      By default, Search Kit considers alphanumeric characters as valid starting characters for terms, and considers all others (including the underscore character) to be nonword characters.

      Available in OS X v10.4 and later.

    • kSKEndTermChars

      kSKEndTermChars

      Additional valid last-position “word” characters for indexing and querying. The corresponding value, a CFString object, specifies the additional valid “word” characters that you want to be considered as valid ending characters of terms for indexing and querying. “Word” characters are contrasted with nonword characters, such as spaces.

      The value of kSKEndTermChars, if this key is present, overrides the value of kSKTermChars for the last character of a term.

      By default, Search Kit considers alphanumeric characters as valid ending characters for terms, and considers all others (including the underscore character) to be nonword characters.

      Available in OS X v10.4 and later.

  • The indexing state of a document.

    Declaration

    Swift

    struct SKDocumentIndexState { init(_ value: UInt32) var value: UInt32 }

    Objective-C

    enum SKDocumentIndexState { kSKDocumentStateNotIndexed = 0, kSKDocumentStateIndexed = 1, kSKDocumentStateAddPending = 2, kSKDocumentStateDeletePending = 3 };

    Constants

    • kSKDocumentStateNotIndexed

      kSKDocumentStateNotIndexed

      Specifies that the document is not indexed.

      Available in OS X v10.3 and later.

    • kSKDocumentStateIndexed

      kSKDocumentStateIndexed

      Specifies that the document is indexed.

      Available in OS X v10.3 and later.

    • kSKDocumentStateAddPending

      kSKDocumentStateAddPending

      Specifies that the document is not in the index but will be added after the index is flushed or closed.

      Available in OS X v10.3 and later.

    • kSKDocumentStateDeletePending

      kSKDocumentStateDeletePending

      Specifies that the document is in the index but will be deleted after the index is flushed or closed.

      Available in OS X v10.3 and later.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Specifies the search options available for the SKSearchCreate function.

    Declaration

    Swift

    typealias SKSearchOptions = UInt32

    Objective-C

    typedef UInt32 SKSearchOptions; enum SKSearchType { kSKSearchOptionDefault = 0, kSKSearchOptionNoRelevanceScores = 1L << 0, kSKSearchOptionSpaceMeansOR = 1L << 1 kSKSearchOptionFindSimilar = 1L << 2 };

    Constants

    • kSKSearchOptionDefault

      kSKSearchOptionDefault

      Default search options include:

      • Relevance scores will be computed

      • Spaces in a query are interpreted as Boolean AND operators.

      • Do not use similarity searching.

      Available in OS X v10.4 and later.

    • kSKSearchOptionNoRelevanceScores

      kSKSearchOptionNoRelevanceScores

      This option saves time during a search by suppressing the computation of relevance scores.

      Available in OS X v10.4 and later.

    • kSKSearchOptionSpaceMeansOR

      kSKSearchOptionSpaceMeansOR

      This option alters query behavior so that spaces are interpreted as Boolean OR operators.

      Available in OS X v10.4 and later.

    • kSKSearchOptionFindSimilar

      kSKSearchOptionFindSimilar

      This option alters query behavior so that Search Kit returns references to documents that are similar to an example text string. When this option is specified, Search Kit ignores all query operators.

      Available in OS X v10.4 and later.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.4 and later.

  • Specifies the category of an index.

    Declaration

    Swift

    struct SKIndexType { init(_ value: UInt32) var value: UInt32 }

    Objective-C

    enum SKIndexType { kSKIndexUnknown = 0, kSKIndexInverted = 1, kSKIndexVector = 2, kSKIndexInvertedVector = 3 };

    Constants

    • kSKIndexUnknown

      kSKIndexUnknown

      Specifies an unknown index type.

      Available in OS X v10.3 and later.

    • kSKIndexInverted

      kSKIndexInverted

      Specifies an inverted index, mapping terms to documents.

      Available in OS X v10.3 and later.

    • kSKIndexVector

      kSKIndexVector

      Specifies a vector index, mapping documents to terms.

      Available in OS X v10.3 and later.

    • kSKIndexInvertedVector

      kSKIndexInvertedVector

      Specifies an index type with all the capabilities of an inverted and a vector index.

      Available in OS X v10.3 and later.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.

  • Search Kit ignores the kSKLanguageTypes constant. It determines language directly by document content.

    Declaration

    Objective-C

    const CFStringRef kSKLanguageTypes;

    Constants

    • kSKLanguageTypes

      kSKLanguageTypes

      Deprecated—Search Kit ignores this constant.

      In releases of OS X previous to version 10.4, each string in this key’s corresponding value specifies a language to use for indexing. Each such string is a two character ISO 639-1 code. For example, 'en' for English, 'ja' for Japanese, and so on. If this key is not present, Search Kit uses the OS X preferences system to determine the primary language from the user’s locale.

      Available in OS X v10.3 and later.

      Deprecated in OS X v10.4.

  • Search Kit ignores the constants in this group. Use asynchronous searching with SKSearchCreate instead, which uses query syntax to determine search type.

    Declaration

    Swift

    struct SKSearchType { init(_ value: UInt32) var value: UInt32 }

    Objective-C

    enum SKSearchType { kSKSearchRanked = 0, kSKSearchBooleanRanked = 1, kSKSearchRequiredRanked = 2, kSKSearchPrefixRanked = 3 };

    Constants

    • kSKSearchRanked

      kSKSearchRanked

      Deprecated. Specifies a basic ranked search.

      Available in OS X v10.3 and later.

    • kSKSearchBooleanRanked

      kSKSearchBooleanRanked

      Deprecated. Specifies a query that can include Boolean operators including '|', '&', '!', '(', and ')'.

      Available in OS X v10.3 and later.

    • kSKSearchRequiredRanked

      kSKSearchRequiredRanked

      Deprecated. Specifies a query that can include required ('+') or excluded ('-') terms.

      Available in OS X v10.3 and later.

    • kSKSearchPrefixRanked

      kSKSearchPrefixRanked

      Deprecated. Specifies a prefix-based search, which matches terms that begin with the query string.

      Available in OS X v10.3 and later.

    Import Statement

    Objective-C

    @import CoreServices;

    Swift

    import CoreServices

    Availability

    Available in OS X v10.3 and later.