Function

SKSearchResultsCreateWithQuery

Queries the indexes in a search group.

Declaration

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 SKSearchType 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.

See Also

Legacy Support for Synchronous Searching

SKSearchGroupCreate

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

Deprecated
SKSearchGroupCopyIndexes

Obtains the indexes for a search group.

Deprecated
SKSearchGroupGetTypeID

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

Deprecated
SKSearchResultsCreateWithDocuments

Finds documents similar to given example documents.

Deprecated
SKSearchResultsGetInfoInRange

Extracts information from a Search Kit query result.

Deprecated
SKSearchResultsCopyMatchingTerms

Obtains the terms in a document that match a query.

Deprecated
SKSearchResultsGetCount

Gets the total number of found items in a search.

Deprecated
SKSearchResultsGetTypeID

Gets the type identifier for Search Kit search results.

Deprecated