Today, I'd like to share with you a hidden gem inside of Windows Vista's search capabilities. It's a neat little feature that lets you build one saved search on top of another, and we call it Query Composition. Think composition in the mathematical sense, not in the context of writing an English paper. To explain this feature, I'd like to start by talking a bit about Libraries.
If you've followed the development of the search features in Windows Vista, you'll know that we played around with the idea of Libraries for quite a while. Instead of each user having their special Documents, Music, and Pictures folders on the Start Menu, there were the Documents Library, the Music Library and the Pictures Library. These libraries were essentially a saved search that ran over all your files and found the appropriate kind for each library.
What many people didn't realize is that all of these were built on top of the one master library aptly named Library, which was just an unqualified search for all of your files. Each of the kind-specific libraries were defined like this: "Find all results in Library that are of kind <Document, Picture, Music, etc.>" This makes a lot of sense, because you'd expect to find all the documents in your Documents Library in your Library as well, along with a bunch of other kinds of files. It also had the benefit of automatically updating your Documents, Pictures, Music, etc. libraries anytime you updated Library. Back around the Beta 1 timeframe, we provided mechanisms for adding new folders to your Library. By default, Library just searched over your user profile and the Public profile, but in every folder there was a button "Add to Library" that would let you add it to the definition of your Library (when possible, it would also add the folder to the index). And as soon as you did, all your specialized libraries were automatically updated because they referenced the one Library.
We originally designed query composition as a way to build powerful searches and save a set of search locations (which we called “scopes”) that could be reused in other searches. When we created Libraries, we realized that we could easily leverage the query processing engine we had written to build the kind-specific libraries on top of the one master Library. As development of Windows Vista continued, we got a lot of feedback that said people weren't ready to move to a library-based file explorer just yet, so we scaled back on the Library vision a bit. But all the pieces to compose a search on another are still there; when we restructured the way we presented saved searches to the end user, we didn't modify our query processing engine.
So, how do you go about composing a search on another? First, start by saving a useful search. Perhaps you save a search for Show only:Document, Author=<Your Name>, Size>1KB using the Advanced Search pane, naming it "Documents I Wrote".

Now you want to make an "Important Documents" search that is all of the documents you wrote that have the Tag "Important". Instead of re-doing all the work you did to build “Documents I Wrote”, you can just build “Important Documents” by composing on “Documents I Wrote.” To do this, open the Advanced Search pane and pull down the Location drop-down. Near the bottom is a Choose Search Locations... entry - select that one. You should see a dialog like this:

Now, scroll down to the bottom of the tree at the top and expand the “Search Folders" node. Check "Documents I Wrote" and then press OK. Now add your Tags=Important filter in the Advanced Search pane and press Search. You should see that you now have all the documents you wrote that are tagged Important.

The previous example is rather simplistic, but the query processing engine in Windows Vista allows you to do more powerful things like compose upon more than one search at a time. Start by saving a "Documents Justin Wrote" search with Show only:Document, Author=Justin, Size>4KB.

Now let's assume you are working on a project where your important documents are written by either you or Justin. Try building “Important Documents” on top of both “Documents I Wrote” and “Documents Justin Wrote” - in the Choose Search Locations dialog just check both of these search folders. When you run this search, you'll see that you get documents tagged Important written by either you or Justin!

This process easily scales to allow you to select many search folders as the basis of the search you're creating. You can even select both search folders and regular physical folders as the locations for a search. Additionally, if the search folder you select when creating a new search happens to be defined as referring to yet another search folder, Windows Vista's query processing engine will handle that properly, too.
Here's another interesting point - if you happen to change a search folder that is referenced by another search, the results will automatically be updated in both searches. I know that editing searches isn't very easy in the UI that Explorer provides, but we hope to release a Windows Vista Power Toy that will allow you to edit search folders and manipulate significantly more complicated filters. It should be similar to the advanced search pane that was available in Beta 1 of Windows Vista.
Finally, you may be interested to know that the Library concept hasn’t been completely removed from Windows Vista. All of the Recent <Documents, Pictures, etc.> searches that are automatically installed in your Searches folder leverage this ability - they're all composed upon a search folder called "Indexed Locations," which automatically updates to search whatever folders you've configured to be indexed. Indexed Locations is also the default search location for all the searches you run by clicking on the Search link in the Start Menu, and any search you save from there will be composed upon “Indexed Locations” as well.