Platforms to show: All Mac Windows Linux Cross-Platform
MDQueryMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Spotlight | MBS MacOSX Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Depending on what and how you want to search, you can decide whether MDQueryMBS or CatSearchMBS is the better choice.
Available in Mac OS X version 10.4 and later.
Queries gather results or process updates only while the current thread's run loop is running. Queries normally operate asynchronously, and only send out progress notificiations as the list is being collected. The query list is kept up to date with respect to value lists and sorting as the progress notifications are sent out, so the query is in a good state during those events.
An MDQuery presents its results as if it were a simple array object. The results are MDItem.
Query Sorting Sorting the results from a query can be performed in one of two ways. First is to let the library sort the results for you by passing an array of attributes to sort on to constructor. The default sort provided by the constructor is a assending sort strings are compared using CFStringCompare() with the options kCFCompareNonliteral | kCFCompareLocalized | kCFCompareNumerically.
If used in a thread, please use a loop with calling NSRunLoopMBS.currentRunLoop.runUntilDate(nil) to give time for update events to fire.
- 3 events
- 3 properties
- property Handle as Integer
- property Tag as Variant
- property BatchingParameters as MDQueryBatchingParamsMBS
- 26 methods
- method AttributeValueOfResultAtIndex(name as string, index as UInt32) as Variant
- method Constructor(query as MDQueryMBS, queryString as string)
- method Constructor(query as MDQueryMBS, queryString as string, valueListAttributes() as string)
- method Constructor(query as MDQueryMBS, queryString as string, valueListAttributes() as string, sortingAttributes() as string)
- method Constructor(queryString as string)
- method Constructor(queryString as string, valueListAttributes() as string)
- method Constructor(queryString as string, valueListAttributes() as string, sortingAttributes() as string)
- method CountOfResultsWithAttributeValue(name as string, Value as Variant) as UInt32
- method DisableUpdates
- method EnableUpdates
- method Execute(flags as Integer) as boolean
- method GetSortOptionFlagsForAttribute(fieldName as string) as Integer
- method IndexOfResult(it as MDItemMBS) as Integer
- method IsGatheringComplete as boolean
- method QueryString as string
- method ResultAtIndex(index as Integer) as MDItemMBS
- method ResultCount as Integer
- method Results(limit as Integer = -1) as MDItemMBS()
- method SetMaxCount(size as Integer)
- method SetSearchScope(paths() as folderitem, options() as string)
- method SetSortOptionFlagsForAttribute(fieldName as string, flags as UInt32) as Boolean
- method SetSortOrder(sortingAttrs() as string) as Boolean
- method SortingAttributes as string()
- method Stop
- method ValueListAttributes as string()
- method ValuesOfAttribute(name as string) as Variant()
- 9 constants
Constants
Constant | Value | Description |
---|---|---|
kMDQueryReverseSortOrderFlag | 1 |
A flag constant for calling SetSortOptionFlagsForAttribute.
Sort the attribute in reverse order. Available on Mac OS X 10.7 or later. |
kMDQueryScopeAllIndexed | "kMDQueryScopeAllIndexed" |
One of the option constants for the search scope.
A constant, which can be passed in the scopeDirectories array, to specify that the search should be restricted to indexed, locally mounted volumes and indexed user mounted remote volumes, plus the user's home directory. |
kMDQueryScopeComputer | "kMDQueryScopeComputer" |
One of the option constants for the search scope.
A constant, which can be passed in the scopeDirectories array, to specify that the search should be restricted to all locally mounted volumes, plus the user's home directory (which may be on a remote volume). |
kMDQueryScopeComputerIndexed | "kMDQueryScopeComputerIndexed" |
One of the option constants for the search scope.
A constant, which can be passed in the scopeDirectories array, to specify that the search should be restricted to indexed, locally mounted volumes, plus the user's home directory (which may be on a remote volume). |
kMDQueryScopeHome | "kMDQueryScopeHome" |
One of the option constants for the search scope.
A constant, which can be passed in the scopeDirectories array, to specify that the search should be restricted to the volume and directory that contains the current user's home directory |
kMDQueryScopeNetwork | "kMDQueryScopeNetwork" |
One of the option constants for the search scope.
A constant, which can be passed in the scopeDirectories array, to specify that the search should include all user mounted remote volumes. |
kMDQueryScopeNetworkIndexed | "kMDQueryScopeNetworkIndexed" |
One of the option constants for the search scope.
A constant, which can be passed in the scopeDirectories array, to specify that the search should include indexed user mounted remote volumes. |
kMDQuerySynchronous | 1 |
One of the constants for executing a query.
Block during the gathering phase. If this parameter is true, the function will not return until the query has finished gathering the initial results. The run loop will run in the default mode, which will allow anything registered in that mode with this run loop to execute as well. If this parameter is false, the function returns immediately after starting the query asychronously. |
kMDQueryWantsUpdates | 4 | One of the constants for executing a query. When set, after gathering the initial results the query will watch for changes in the system which should update the list of results. This can be changes which cause new files to now match the query, or changes which cause files in the result list to continue to match, or no longer match, the query. Files which begin to match the query are added to the result list, and files which no longer match the query expression are removed from the result list. more |
This class has no sub classes.
Some examples using this class:
- /DynaPDF/Raster/Search and show PDF files
- /MacOSX/Spotlight/Find REALbasic Projects
- /MacOSX/Spotlight/Query
- /MacOSX/Spotlight/Query with attributes
- /MacOSX/Spotlight/Search all applications
- /MacOSX/Spotlight/Search all applications in applications folder
- /MacOSX/Spotlight/Search all disc images
- /MacOSX/Spotlight/Search REALbasic
Blog Entries
- MBS Xojo / Real Studio Plugins, version 13.5pr3
- MBS Plugins 11.1 Release notes
- MBS Real Studio Plugins, version 11.1pr10
- MBS Real Studio Plugins, version 11.1pr7
- MBS REALbasic plug-in 9.6
The items on this page are in the following plugins: MBS MacOSX Plugin.
MDQueryBatchingParamsMBS - MediaKeysMBS