Class: NSMetadataQuery
Overview
The NSMetadataQuery class encapsulates the functionality provided by the MDQuery opaque type for querying the Spotlight metadata.
Instance Method Summary (collapse)
-
- delegate
Returns the receiver’s delegate.
-
- disableUpdates
Disables updates to the query results.
-
- enableUpdates
Enables updates to the query results.
-
- groupedResults
Returns an array containing hierarchical groups of query results based on the receiver’s grouping attributes.
-
- groupingAttributes
Returns the receiver’s grouping attributes.
-
- indexOfResult:
Returns the index of a query result object in the receiver’s results array.
-
- init
Initializes an allocated NSMetadataQuery object.
-
- isGathering
Returns a Boolean value that indicates whether the receiver is in the initial gathering phase of the query.
-
- isStarted
Returns a Boolean value that indicates whether the receiver has started the query.
-
- isStopped
Returns a Boolean value that indicates whether the receiver has stopped the query.
-
- notificationBatchingInterval
Returns the interval that the receiver provides notification of updated query results.
-
- predicate
Returns the predicate the receiver uses to filter query results.
-
- resultAtIndex:
Returns the query result at a specific index.
-
- resultCount
Returns the number of results returned by the receiver.
-
- results
Returns an array containing the result objects for the receiver.
-
- searchScopes
Returns an array containing the receiver’s search scopes.
-
- setDelegate:
Sets the receiver’s delegate.
-
- setGroupingAttributes:
Sets the receiver’s grouping attributes to specific attribute names.
-
- setNotificationBatchingInterval:
Sets the interval between update notifications sent by the receiver.
-
- setPredicate:
Sets the predicate used by the receiver to filter the query results.
-
- setSearchScopes:
Restrict the search scope of the receiver.
-
- setSortDescriptors:
Sets the sort descriptors to be used by the receiver.
-
- setValueListAttributes:
Sets the value list attributes for the receiver to the specific attribute names.
-
- sortDescriptors
Returns an array containing the receiver’s sort descriptors.
-
- startQuery
Attempts to start the query.
-
- stopQuery
Stops the receiver’s current query from gathering any further results.
-
- valueListAttributes
Returns an array containing the value list attributes the receiver generates.
-
- valueLists
Returns a dictionary containing the value lists generated by the receiver.
-
- valueOfAttribute:forResultAtIndex:
Returns the value for the attribute name attrName at the index in the results specified by idx.
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Instance Method Details
- (Object) delegate
Returns the receiver’s delegate.
- (Object) disableUpdates
Disables updates to the query results. You should invoke this method before iterating over query results that could change due to live updates.
- (Object) enableUpdates
Enables updates to the query results. You should invoke this method after you’re done iterating over the query results.
- (Array) groupedResults
Returns an array containing hierarchical groups of query results based on the receiver’s grouping attributes.
- (Array) groupingAttributes
Returns the receiver’s grouping attributes.
- (Integer) indexOfResult(result)
Returns the index of a query result object in the receiver’s results array.
- (Object) init
Initializes an allocated NSMetadataQuery object.
- (Boolean) isGathering
Returns a Boolean value that indicates whether the receiver is in the initial gathering phase of the query.
- (Boolean) isStarted
Returns a Boolean value that indicates whether the receiver has started the query.
- (Boolean) isStopped
Returns a Boolean value that indicates whether the receiver has stopped the query.
- (NSTimeInterval) notificationBatchingInterval
Returns the interval that the receiver provides notification of updated query results.
- (NSPredicate) predicate
Returns the predicate the receiver uses to filter query results.
- (Object) resultAtIndex(index)
Returns the query result at a specific index. For performance reasons, you should use this method when retrieving a specific result, rather than they array returned by results.
- (Integer) resultCount
Returns the number of results returned by the receiver. For performance reasons, you should use this method, rather than invoking count on results.
- (Array) results
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.
- (Array) searchScopes
- (Object) setDelegate(delegate)
Sets the receiver’s delegate
- (Object) setGroupingAttributes(attributes)
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.
- (Object) setNotificationBatchingInterval(timeInterval)
Sets the interval between update notifications sent by the receiver.
- (Object) setPredicate(predicate)
Sets the predicate used by the receiver to filter the query results. Invoking this method on a receiver running a query causes the existing query to stop, all current results are discarded, and a new query is started immediately.
- (Object) setSearchScopes(scopes)
Restrict the search scope of the receiver.
- (Object) setSortDescriptors(descriptors)
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.
- (Object) setValueListAttributes(attributes)
Sets the value list attributes for the receiver to the specific attribute names. The query collects the values of these attributes into uniqued lists that can be used to summarize the results of the query. If attributess is nil, the query generates no value lists. Note that value list collection increases CPU usage and significantly increases the memory usage of an NSMetadataQuery object.Invoking this method on the receiver while it’s running a query, stops the query and discards current results, and immediately starts a new query.
- (Array) sortDescriptors
Returns an array containing the receiver’s sort descriptors.
- (Boolean) startQuery
Attempts to start the query. A query can’t be started if the receiver is already running a query or no predicate has been specified.
- (Object) stopQuery
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.
- (Array) valueListAttributes
Returns an array containing the value list attributes the receiver generates.
- (Hash) valueLists
Returns a dictionary containing the value lists generated by the receiver.
- (Object) valueOfAttribute(attributeName, forResultAtIndex:index)
Returns the value for the attribute name attrName at the index in the results specified by idx.