Skip Navigation LinksHome > View Post

Windows Search and the file scheme

Well, I've been up against this for a while now and I'm pretty delighted to have cracked it at last.

In my earlier post Using Windows Search in your applications I had integrated search in an proof of concept.

The one thing I didn't mention at the time was how this worked fine on Windows 7 (against which I was developing) but did nothing on Windows Vista. Weird.

I spent a lot of time trying to see how Vista's search was interpreting the data store. Was the folder hidden? Did that make any difference? Was the FANCI (Not Content Indexed) bit set properly. And round in circles I went.

Until we did a search in Windows Explorer and saw that it was returning results appropriately and they had indeed been indexed!

So it had to be my query. Spot the difference, the first one doesn't work on Vista

SELECT System.ItemPathDisplay FROM SYSTEMINDEX WHERE FREETEXT('powershell') AND DIRECTORY = 'C:\Users\me\Documents'

... but this one does...

SELECT System.ItemPathDisplay FROM SYSTEMINDEX WHERE FREETEXT('powershell') AND DIRECTORY = 'file:C:\Users\me\Documents'

That's right. Vista requires the 'file:' scheme when specifying DIRECTORY. It's my own fault, one of the product engineers warned me that it was a bad idea to not specify the file scheme. Clearly, he was right. You have been warned.

 
Josh Post By Josh Twist
10:50 AM
24 Jun 2009

» Next Post: Using Binding to position a Collection of elements - Take 2
« Previous Post: AutoExit for Windows Home Server

Comments are closed for this post.

Posted by Andy Sandefer @ 26 May 2011 4:54 PM
I know that this is an old post but I wanted to say thank you as I had to deploy a web app that I developed on Windows 7/Windows 2008 Server on a Windows 2003 x64 Server and your post definitely assisted me in troubleshooting issues. Everything is working properly now and this post solved my final issue.
Thanks a lot!

© 2005 - 2014 Josh Twist - All Rights Reserved.