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.