Search sample

Sun, September 24, 2006, 07:40 AM under Windows | Vista
To programmatically use search, I've already mentioned that as a managed developer you should be looking at Catherine Heller's blog and nothing has changed. From there you can find a whole bunch of useful info including the relevant links to msdn and the windows sdk. I am not repeating them here 'cause I really want you to visit the source and learn :-)

So the point of this blog post is simply to share with you the sample I use in my sessions when demoing how to search from your applications. Download the zip here.

After you build the VS2005 solution, when you run the app, you'll see the following in the textbox:
SELECT <columns> FROM SYSTEMINDEX..SCOPE() [WHERE <predicates>]

To start with replace it with this (and hit the button to see the results in the datagrid):
SELECT "System.FileName", "System.Size", "System.DateModified", "System.ItemType" FROM SYSTEMINDEX..SCOPE() WHERE "Directory"='file:c:\Windows\System32' ORDER BY "System.ItemType"

As I said, to learn more about the OleDb provider connection string and the query syntax, follow links from my previous Vista Search blog post.