Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom source for Windows 7 Start Menu Search

I recently came across an article about Windows 7's new Federated Search and Search Connectors. Basically, you provide users a small XML file (.osdx; an OpenSearch XML file) and they can then use Explorer to search whatever you've got. These Search Connectors actually really easy to implement – Explorer calls your URL with a query and you just return the results as RSS.

Great. I'm currently working on a web app where this kind of functionality might be a nice little extra feature to provide to my users. So I installed the sample .osdx and tried it out. It works pretty much as advertised:


(source: msdn.com)

That's cool, but I want my search results to be available from the Start menu. The point (in my mind) would be to make items within my web app easily, quickly, and directly accessible when the app itself isn't already open. If I have to open an Explorer window, click on my Search Connector, and then search, what's the difference from just opening a browser and doing the search in the web app?

Here's what I've tried:

  • After the .osdx is installed, the Connector is saved as %UserProfile%\Searches\name.searchConnector-ms. Other items in this folder include Outlook's Connector. Looking at that file, there's a very promising node named <includeInStartMenuScope>. I added this node with a value of true to the Channel 9 Connector, but no luck. (I even tried a reboot.)
  • I came across a year-old question that asks just about the same thing. The accepted answer directs us to the Windows API Code Pack, but that only provides classes for consuming Windows Search, not implementing a Search Provider.
  • The registry trick from Scott Hanselman. However, this (a) only pins a link to run the search rather than including results inline, and (b) doesn't work for me since I (nor can I expect my users) to have Windows 7 Ultimate.

So, how do I supply items to the Start menu's instant search? Ideally, I'd like to just configure the Search Connector's results to be included, but I'm not opposed to wiring up something in C# that would be installed on the client computer.

like image 759
josh3736 Avatar asked Sep 30 '10 21:09

josh3736


1 Answers

Traditionally, the way to extend Windows Search has been via IFilters that allow Windows to understand new types of files. This approach will certainly tie you into the Start button results.

In this case, you are dealing with federated search, which makes online content act as if it were present on the user's computer.

Unfortunately, I can't find anything that obviously solves your problem. Consequently, you may have to build a kludge in 2 parts:

  1. An IFilter for your search results (say, a "*.C9" file).
  2. A file ending in "C9".

Incidentally, if you do a web search on the term "IFilter" and go to the first few search results, you might think that IFilters are no longer used due to a note at the top of the page.

If that happens, then you're at the old IFilter site. The current URL for the MSDN docs about this topic is at http://msdn.microsoft.com/en-us/library/bb266451(v=VS.85).aspx.

One last note of warning:

In Windows 7 and later, filters written in managed code are explicitly blocked. Filters MUST be written in native code due to potential CLR versioning issues with the process that multiple add-ins run in.

like image 61
Zian Choy Avatar answered Oct 14 '22 18:10

Zian Choy