MPSearchQuery

Rule-based search query and user interface [download]

This code implements a straightforward rule-based search and a user interface to edit it. The design is general purpose but was inspired by iTunes' "Smart Playlists" feature. In the interface, rules are built up by adding new lines of interface controls based on the selection in the left-most property menu. The design uses a delegate to supply a set of properties that can be searched on. The window can be deployed as a standalone modeless dialog (as shown) or as a sheet attached to another window. The window expands and shrinks as needed to accommodate the number of rows added. The controls are set up using templates constructed in Interface Builder.

Supplied as full source code embedded within a simple test application. Documentation to come; code is comprehensively commented.

Compatible with Mac OS X 10.2 or later. Does not use or require NSPredicate, though it does provide similar functionality.