---
title: SKSearchResultsCreateWithQuery
framework: Core Services
role: symbol
role_heading: Function
platforms: [macOS 10.3+]
path: coreservices/1448610-sksearchresultscreatewithquery
---

# SKSearchResultsCreateWithQuery

Queries the indexes in a search group.

## Declaration

```occ
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 doc://com.apple.documentation/documentation/coreservices/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 doc://com.apple.documentation/documentation/coreservices/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 doc://com.apple.documentation/documentation/coreservices/sksearchresultsfiltercallback.

## Return Value

Return Value A search results object.

## Discussion

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](coreservices/1448627-sksearchgroupcreate.md)
- [SKSearchGroupCopyIndexes](coreservices/1448615-sksearchgroupcopyindexes.md)
- [SKSearchGroupGetTypeID](coreservices/1448637-sksearchgroupgettypeid.md)
- [SKSearchResultsCreateWithDocuments](coreservices/1448629-sksearchresultscreatewithdocumen.md)
- [SKSearchResultsGetInfoInRange](coreservices/1448618-sksearchresultsgetinfoinrange.md)
- [SKSearchResultsCopyMatchingTerms](coreservices/1448612-sksearchresultscopymatchingterms.md)
- [SKSearchResultsGetCount](coreservices/1448598-sksearchresultsgetcount.md)
- [SKSearchResultsGetTypeID](coreservices/1448603-sksearchresultsgettypeid.md)
