Search code examples
objective-cmacoscocoaspotlight

Limit scope of NSMetadataQuery


I was trying to restrict the scope of an NSMetadataQuery item. I know there's the -setSearchScope: method (see the docs), but it lets me only decide in which directories the item will search.

What if I need to exclude one or more directories from the scope?


Solution

  • Unfortunately, I don't believe this is possible, since the kMDItemPath attribute is not indexed by Spotlight, and is therefore not usable in a query.

    File a bug.