---
title: "SKIndexCopyDocumentIDArrayForTermID(_:_:)"
framework: Core Services
role: symbol
role_heading: Function
platforms: [macOS 10.3+]
path: coreservices/1448003-skindexcopydocumentidarrayforter
---

# SKIndexCopyDocumentIDArrayForTermID(_:_:)

Obtains document IDs for documents that contain a given term.

## Declaration

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

## Parameters

- `inIndex`: The index to search.
- `inTermID`: The ID of the term to search for.

## Return Value

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

## Discussion

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.

## See Also

### Working with Documents and Terms

- [SKDocumentCreateWithURL(_:)](coreservices/1442564-skdocumentcreatewithurl.md)
- [SKDocumentCreate(_:_:_:)](coreservices/1443212-skdocumentcreate.md)
- [SKDocumentCopyURL(_:)](coreservices/1449624-skdocumentcopyurl.md)
- [SKDocumentGetName(_:)](coreservices/1442657-skdocumentgetname.md)
- [SKDocumentGetParent(_:)](coreservices/1444449-skdocumentgetparent.md)
- [SKDocumentGetSchemeName(_:)](coreservices/1448262-skdocumentgetschemename.md)
- [SKDocumentGetTypeID()](coreservices/1448891-skdocumentgettypeid.md)
- [SKIndexCopyDocumentForDocumentID(_:_:)](coreservices/1442760-skindexcopydocumentfordocumentid.md)
- [SKIndexCopyInfoForDocumentIDs(_:_:_:_:_:)](coreservices/1445499-skindexcopyinfofordocumentids.md)
- [SKIndexCopyDocumentRefsForDocumentIDs(_:_:_:_:)](coreservices/1445305-skindexcopydocumentrefsfordocume.md)
- [SKIndexCopyDocumentURLsForDocumentIDs(_:_:_:_:)](coreservices/1443501-skindexcopydocumenturlsfordocume.md)
- [SKIndexCopyTermIDArrayForDocumentID(_:_:)](coreservices/1446868-skindexcopytermidarrayfordocumen.md)
- [SKIndexCopyTermStringForTermID(_:_:)](coreservices/1442802-skindexcopytermstringfortermid.md)
- [SKIndexGetTermIDForTermString(_:_:)](coreservices/1448558-skindexgettermidfortermstring.md)
- [SKIndexSetDocumentProperties(_:_:_:)](coreservices/1444576-skindexsetdocumentproperties.md)
- [SKIndexCopyDocumentProperties(_:_:)](coreservices/1449500-skindexcopydocumentproperties.md)
- [SKIndexGetDocumentState(_:_:)](coreservices/1443396-skindexgetdocumentstate.md)
- [SKIndexGetDocumentTermCount(_:_:)](coreservices/1448341-skindexgetdocumenttermcount.md)
- [SKIndexGetDocumentTermFrequency(_:_:_:)](coreservices/1447537-skindexgetdocumenttermfrequency.md)
- [SKIndexGetTermDocumentCount(_:_:)](coreservices/1444015-skindexgettermdocumentcount.md)
- [SKIndexGetDocumentID(_:_:)](coreservices/1444437-skindexgetdocumentid.md)
