Searching the File System in VIsta

Wow, I can't believe howe much trouble I've had getting search to work in Windows Vista!  Based on a quote from MSDN:

"You can use new Windows Vista APIs to query items in the Windows Search Engine. Your application can use the OLEDB/ADO from managed or unmanaged code to issue queries using a SQL-like syntax. In return, your application receives an OLEDB Recordset where the columns correspond to properties in the Windows Metadata System, for example, System.Photo.FNumber." -- http://msdn.microsoft.com/windowsvista/prodinfo/what/discoverable/default.aspx
I cannot find documentation on this feature anywhere!  I have a sample from the December CTP that uses a weird OLE DB provider (USearch.CollatorDSO.1), but aside from one reference on an MSDN forum posting, no one is talking about this!  There are plenty of options on using Indexing Server for ASP.NET applications, and samples for the MSN or Google Desktop Search, but what about the new-fangled Windows Search Engine?  It's supposed to be a big part of the OS, but no mention of that I can find.  I can't imagine that they've backed off of it.  I think that you can programmatically do object-based queries, but as quoted above, it's supposed to be SQL-queryable as well.  It's pretty frustrating.  I'm about ready to give up.  If I try to use the standard Indexing Service, I need to create a catalog and add folders.  I don't think that's the same thing (MSIDXS provider) as its been around since Windows 2000 or so.  If anyone knows anything, let me know!

UPDATE (6/15): I got it working!  Such a simple change, but how to figure it out?  After some guessing, I discovered that it should be "Search.CollatorDSO.1" (note the missing "U").  There is also an extended property.  Here's the complete connection string:

Provider=Search.CollatorDSO.1;Extended Propertes="Application=Windows"

Those quotes may need to be escaped, depending on your environment.  I'm so excited (yes, it doesn't take much!).  You should use systemindex..scope() as the FROM clause, and some columns include System.Title and System.Size.  Have fun!

UPDATE (6/16): One more update!  I found the link to all system properties (remember that you can create custom ones too...).  If you want to know what you can query, here's the list (actually, the correct list can only be found offline in the Windows SDK Beta 2 at: User Interface->Windows Shell->Shell Reference->Shell Properties).  Very impressive so far!  I really think this can enable some cool stuff.  I'll post some sample code and a few more thoughts soon.


UPDATE (7/5): It looks like someone at Microsoft has finally gotten a few resources out there on Windows Desktop Search 3.0 (the official name for all of this).  You can even download it for Windows XP and 2000!  Check out Searching for Windows Vista?  Unfortunately, it clears up something I had been trying without success.  It's read-only.  This is disappointing, especially now that WinFS will no longer provide that great relational DB<->file system mapping.  Oh well.  Also, my property list in my original post is no longer correct.  I've fixed that.

FINAL UPDATE (7/11): The above link has a part two regarding search predicates for Vista.  Read more here.  I plan on rolling all of this into a new link when I have a few minutes!


In itil training, every course matters, whether it is of network plus or something simpler from security+. It does not have to be a cisco certification always.

posted @ Wednesday, June 14, 2006 4:08 PM

       Print

Comments on this entry:

# re: Searching the File System in VIsta

Left by Sean McLeod at 6/19/2006 2:02 AM
Gravatar
Hi

I had a similiar experience when looking for the SDK documentation on WDS 3.0 (the indexing/search engine in Vista). I'd previously written an application making use of the WDS 2.6 API and posted the following question about SDK documentation on the WDS 3.0 API.

You'll see a comment from someone at MS stating that the WDS 3.0 API docs didn't make it into the Vista beta2 SDK but they are coming. Hopefully sooner rather than later.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=462273&SiteID=1

Cheers

# re: Searching the File System in VIsta

Left by at 9/26/2006 4:44 AM
Gravatar
This is really a useful information. Can you explain little bit more ragarding what dll to reference?, which query interface to use. In WDS2.6.5 SDK, i was referencing WDSQuery.dll and using ExecuteQuery().

Regards
Hary

# re: Searching the File System in VIsta

Left by Arian at 9/26/2006 5:59 AM
Gravatar
I've done this using managed code and straight ADO.NET. No extra libraries or API's need to be referenced. I'll see if I can post an example in a few days. I haven't actually looked at this since July, so it may be different again (and maybe covered in the docs) for RC1.

-Arian

# re: Searching the File System in VIsta

Left by Hary at 9/27/2006 4:33 AM
Gravatar
Arian

Is dotNet frame work 3.0 is must for WDS 3.0? since WDS3.0 SDK is part of Windows vista SDk and Windows vista requires DotNet Framework 3.0, it requires framwork 3.0.
I am little bit confused - WDS 2.6.5 works on dot net framework 1.1 ans 2.0 and WDS 3.0 works only on framework 3.0!

Hary

# re: Searching the File System in VIsta

Left by hary at 11/3/2006 4:10 AM
Gravatar
Can you explain in breif about how can we search programatically for a given string using WDS 3.0. please reply asap...i need this info badly

# re: Searching the File System in VIsta

Left by Arian at 11/4/2006 4:11 PM
Gravatar
TO search for full text, use the CONTAINS or FREETEXT predicates. The only difference is that FREETEXT sets the rank as well.

You'd have:
SELECT System.Title FROM systemindex..scope() WHERE CONTAINS(' "phrase to search for" ')

Note that the provider string has changed. Your connection creation (in C#) should look like:
OleDbConnection conn = new OleDbConnection(
"Provider=Search.CollatorDSO;Extended Properties='Application=Windows';");

# re: Searching the File System in VIsta

Left by jack at 11/6/2006 6:37 AM
Gravatar
i found the info very useful. but can you tell me what is the "Search.CollatorDSO". This question might be silly. but i am new to .net. Jus pickin up things as need comes so pls forgive my ignorance. pls reply asap.

# re: Searching the File System in VIsta

Left by Arian at 11/6/2006 7:53 AM
Gravatar
Database support in ADO and OLE is based on providers. Each type of database has a different provider implementation that is responsible for actually communicating with the database. Without providers, you would need to know the nuts and bolts of how to communicate with each different database (this is how it was way back when!).

By the way, check out my updated entry on search: http://www.ariankulp.com/archive/2006/11/05/1921.aspx
Comments have been closed on this topic.
«September»
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789