Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

MDQueryMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Spotlight MBS MacOSX Plugin 9.6 Yes No No Yes, macOS only No
Function: MDQuery encapsulates all queries against the MetaData database.
dim m as new MDQueryMBS("* == ""Hello""wcd || kMDItemTextContent = ""Hello""c")

call m.Execute(m.kMDQuerySynchronous)

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.

Feedback, Comments & Corrections

This class has no sub classes.

Some examples which use this class:

Blog Entries

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

MDQueryBatchingParamsMBS   -   MediaKeysMBS

The biggest plugin in space...

MBS Xojo PDF Plugins