---
title: SKSearchResultsCopyMatchingTerms
framework: Core Services
role: symbol
role_heading: Function
platforms: [macOS 10.3+]
path: coreservices/1448612-sksearchresultscopymatchingterms
---

# SKSearchResultsCopyMatchingTerms

Obtains the terms in a document that match a query.

## Declaration

```occ
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 doc://com.apple.documentation/documentation/coreservices/1448610-sksearchresultscreatewithquery, the document URL objects are sorted in ranking order with the top-ranked one first. See doc://com.apple.documentation/documentation/coreservices/1448618-sksearchresultsgetinfoinrange for a description of how to get a particular document URL object, or set of them, from a search result.

## Return Value

Return Value A CFArray object containing term IDs.

## Discussion

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 SKSearchType for a description of the various categories of search.

## 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)
- [SKSearchResultsGetCount](coreservices/1448598-sksearchresultsgetcount.md)
- [SKSearchResultsGetTypeID](coreservices/1448603-sksearchresultsgettypeid.md)
- [SKSearchResultsCreateWithQuery](coreservices/1448610-sksearchresultscreatewithquery.md)
