<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.13.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSCoreDataCoreSpotlightDelegate/attributeSet(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCoreDataCoreSpotlightDelegate(im)attributeSetForObject:"
  },
  "title" : "attributeSet(for:)"
}
-->

# attributeSet(for:)

Returns the searchable attributes for the specified managed object.

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

## Parameters

`object`

The managed object to index.

## Return Value

An instance of <doc://com.apple.documentation/documentation/CoreSpotlight/CSSearchableItemAttributeSet> that provides the searchable item’s attributes.

## Discussion

> Important:
> If you enable ``doc://com.apple.coredata/documentation/CoreData/NSPropertyDescription/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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)