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.

Post a comment:

Name  

E-mail (never shared)

URL

Comments  

Captcha ImageRefresh Image
What's this?
Enter code above