|Type||Topic||Plugin||Version||macOS||Windows||Linux||Console & Web||iOS|
|class||Spotlight||MBS MacOSX Plugin||9.6||Yes||No||No||Yes, macOS only||No|
dim m as new MDQueryMBS("* == ""Hello""wcd || kMDItemTextContent = ""Hello""c")
MsgBox str(m.ResultCount) // shows a lot of results
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
- 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
- const kMDQueryReverseSortOrderFlag=1
- const kMDQueryScopeAllIndexed="kMDQueryScopeAllIndexed"
- const kMDQueryScopeComputer="kMDQueryScopeComputer"
- const kMDQueryScopeComputerIndexed="kMDQueryScopeComputerIndexed"
- const kMDQueryScopeHome="kMDQueryScopeHome"
- const kMDQueryScopeNetwork="kMDQueryScopeNetwork"
- const kMDQueryScopeNetworkIndexed="kMDQueryScopeNetworkIndexed"
- const kMDQuerySynchronous=1
- const kMDQueryWantsUpdates=4
This class has no sub classes.
Some examples which use this class:
- /DynaPDF/Raster/Search and show PDF files
- /MacOSX/Spotlight/Find REALbasic Projects
- /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
- MBS Xojo / Real Studio Plugins, version 13.5pr3
- MBS Real Studio Plugins, version 11.1pr10
- MBS Real Studio Plugins, version 11.1pr7
The items on this page are in the following plugins: MBS MacOSX Plugin.
MBS Xojo blog