---
title: "attributeSet(for:)"
framework: coredata
role: symbol
role_heading: Instance Method
path: "coredata/nscoredatacorespotlightdelegate/attributeset(for:)"
---

# attributeSet(for:)

Returns the searchable attributes for the specified managed object.

## Declaration

```swift
func attributeSet(for object: NSManagedObject) -> CSSearchableItemAttributeSet?
```

## Parameters

- `object`: The managed object to index.

## Return Value

Return Value An instance of CSSearchableItemAttributeSet that provides the searchable item’s attributes.

## Discussion

Discussion important: If you enable isIndexedBySpotlight on a property description that describes a relationship, override this method and return the necessary set of attributes. Core Data doesn’t automatically infer indexable information for relationships. To prevent Core Spotlight from indexing a specific managed object, override this method and return nil for that object.

## See Also

### Managing the Index

- [deleteSpotlightIndex(completionHandler:)](coredata/nscoredatacorespotlightdelegate/deletespotlightindex(completionhandler:).md)
- [startSpotlightIndexing()](coredata/nscoredatacorespotlightdelegate/startspotlightindexing().md)
- [stopSpotlightIndexing()](coredata/nscoredatacorespotlightdelegate/stopspotlightindexing().md)
