macosxhints – 10.4: Demystify Spotlight’s saved search syntax
Spotlight saved searches, or “Smart Folders,” are simply XML files with a .savedSearch extension. Within that XML file, which you can open using any text editor, there is a tag called RawQuery; immediately following that is another called (ambiguously) string. The string tag right after the RawQuery tag is the “code” for your search.