---
title: "SKIndexGetTermDocumentCount(_:_:)"
framework: Core Services
role: symbol
role_heading: Function
platforms: [macOS 10.3+]
path: coreservices/1444015-skindexgettermdocumentcount
---

# SKIndexGetTermDocumentCount(_:_:)

Gets the number of documents containing a given term represented in an index.

## Declaration

```swift
func SKIndexGetTermDocumentCount(_ inIndex: SKIndex!, _ inTermID: CFIndex) -> CFIndex
```

## Parameters

- `inIndex`: The index containing the text of the documents you want to examine.
- `inTermID`: The terms whose occurrences you want to know.

## Return Value

Return Value A CFIndex object containing the number of documents represented in an index that contain a given term.

## Discussion

Discussion If you want to know in which documents a term appears across multiple indexes, call this function separately on each index. Before querying each index, get the index-specific term ID using SKIndexGetTermIDForTermString(_:_:). To ensure that this function takes into account document URL objects (of type SKDocument) recently added to indexes, call SKIndexFlush(_:) on each index before calling this function.

## 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)
- [SKIndexCopyDocumentIDArrayForTermID(_:_:)](coreservices/1448003-skindexcopydocumentidarrayforter.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)
- [SKIndexGetDocumentID(_:_:)](coreservices/1444437-skindexgetdocumentid.md)
