Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSMetadataQueryMBS class.

NSMetadataQueryMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes the NSMetadataQuery object.

NSMetadataQueryMBS.Destructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
The destructor.

NSMetadataQueryMBS.disableUpdates

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Disables updates to the query results.

You should invoke this method before iterating over query results that could change due to live updates.

NSMetadataQueryMBS.enableUpdates

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Enables updates to the query results.

You should invoke this method after you're done iterating over the query results.

NSMetadataQueryMBS.groupedResults as NSMetadataQueryResultGroupMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array containing hierarchical groups of query results based on the receiver's grouping attributes.

NSMetadataQueryMBS.groupingAttributes as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the receiver's grouping attributes.

NSMetadataQueryMBS.indexOfResult(item as NSMetadataItemMBS) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the index of a query result object in the receiver's results array.

NSMetadataQueryMBS.isGathering as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a Boolean value that indicates whether the receiver is in the initial gathering phase of the query.

Returns true when the query is in the initial gathering phase; false otherwise.

NSMetadataQueryMBS.isStarted as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a Boolean value that indicates whether the receiver has started the query.

Returns true when the receiver has executed the startQuery method; false otherwise.

NSMetadataQueryMBS.isStopped as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a Boolean value that indicates whether the receiver has stopped the query.

Returns true when the receiver has stopped the query, false otherwise.

NSMetadataQueryMBS.notificationBatchingInterval as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
property iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
The interval that the receiver provides notification of updated query results.

in seconds.
(Read and Write computed property)

NSMetadataQueryMBS.predicate as NSPredicateMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
The predicate used by the receiver to filter the query results.
Example
dim m as new NSMetadataQueryMBS
m.predicate = NSPredicateMBS.predicateWithFormat("kMDItemContentType=""com.apple.application-bundle""")

Setting the predicate on a receiver running a query causes the existing query to stop, all current results are discarded, and a new query is started immediately.
(Read and Write computed property)

NSMetadataQueryMBS.resultAtIndex(index as Integer) as NSMetadataItemMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the query result at a specific index.

index: Index of the desired result in the query result array.
Returns query result at the position specified by index.

For performance reasons, you should use this method when retrieving a specific result, rather than they array returned by results.

NSMetadataQueryMBS.resultCount as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the number of results returned by the receiver.

For performance reasons, you should use this method, rather than invoking count on results array.

NSMetadataQueryMBS.results as NSMetadataItemMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array containing the result objects for the receiver.

The results array is a proxy object that is primarily intended for use with Cocoa bindings. While it is possible to copy the proxy array and receive a "snapshot" of the complete current query results, it is generally not recommended due to performance and memory issues. To access individual result array elements you should instead use the resultCount and resultAtIndex methods.

NSMetadataQueryMBS.searchScopes as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array containing the receiver's search scopes.

The array can contain strings that represent file system directories or the search scopes specified in Constants. An empty array indicates that there is no limitation on where the receiver searches.

NSMetadataQueryMBS.setGroupingAttributes(attributeNames() as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the receiver's grouping attributes to specific attribute names.

Invoking this method on a receiver while it's running a query, stops the query and discards current results, and immediately starts a new query.
Available in Mac OS X v10.4 and later.

NSMetadataQueryMBS.setSearchScopes(folders() as folderitem)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Restrict the search scope of the receiver.

You can pass paths as folderitem.

See also:

Some examples using this method:

NSMetadataQueryMBS.setSearchScopes(paths() as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Restrict the search scope of the receiver.

You can pass paths as strings and with the string array also the special scope strings from this class.

See also:

NSMetadataQueryMBS.setSearchScopes(paths() as string, folders() as folderitem)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Restrict the search scope of the receiver.
Example
dim m as new NSMetadataQueryMBS
dim paths() as string
dim folders() as FolderItem

// you can specify where to search either by path or by FolderItem
'paths.Append "/Applications"
folders.Append SpecialFolder.Applications

m.setSearchScopes paths, folders

You can pass paths as strings, paths as folderitem and with the string array also the special scope strings from this class.

See also:

NSMetadataQueryMBS.setSortDescriptor(sortDescriptor as NSSortDescriptorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the sort descriptors to be used by the receiver.
Example
dim m as new NSMetadataQueryMBS
m.setSortDescriptor NSSortDescriptorMBS.sortDescriptorWithKey(NSMetadataItemMBS.NSMetadataItemDisplayNameKey, true)

Invoking this method on the receiver running a query causes the existing query to stop, all current results are discarded, and a new query is started immediately.

NSMetadataQueryMBS.setSortDescriptors(sortDescriptors() as NSSortDescriptorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the sort descriptors to be used by the receiver.

Invoking this method on the receiver running a query causes the existing query to stop, all current results are discarded, and a new query is started immediately.

NSMetadataQueryMBS.sortDescriptors as NSSortDescriptorMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array containing the receiver's sort descriptors.

Available in Mac OS X v10.4 and later.

NSMetadataQueryMBS.startQuery as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Attempts to start the query.

Returns true when successful; false otherwise.

A query can't be started if the receiver is already running a query or no predicate has been specified.

Some examples using this method:

NSMetadataQueryMBS.stopQuery

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Stops the receiver's current query from gathering any further results.

The receiver first completes gathering any unprocessed results. If a query is stopped before the gathering phase finishes, it will not post an NSMetadataQueryDidStartGatheringNotification notification.

You would call this function to stop a query that is generating too many results to be useful but still want to access the available results. If the receiver is sent a startQuery message after performing this method, the existing results are discarded.

The items on this page are in the following plugins: MBS MacCloud Plugin.


The biggest plugin in space...