Windows 7 开始菜单搜索的自定义源

发布于 2024-09-25 18:54:36 字数 1749 浏览 2 评论 0 原文

我最近看到一篇有关 Windows 7 新功能的文章 联合搜索和搜索连接器。基本上,您为用户提供一个小型 XML 文件(.osdx;OpenSearch XML 文件),然后他们可以使用 Explorer 来搜索您所拥有的任何内容。这些搜索连接器实际上非常容易实现 - Explorer 通过查询调用您的 URL,您只需将结果作为 RSS 返回即可。

伟大的。我目前正在开发一个网络应用程序,这种功能可能是向我的用户提供的一个不错的额外功能。所以我安装了示例 .osdx 并进行了尝试。它的工作原理与广告中的差不多:


(来源:msdn.com

这很酷,但我希望我的搜索结果可以从“开始”菜单中获得。 (在我看来)重点是当应用程序本身尚未打开时,可以轻松、快速、直接地访问我的网络应用程序中的项目。如果我必须打开资源管理器窗口,单击我的搜索连接器,然后进行搜索,这与仅打开浏览器并在 Web 应用程序中进行搜索有什么区别?

这是我尝试过的:

  • 安装 .osdx 后,连接器将保存为 %UserProfile%\Searches\name.searchConnector-ms。此文件夹中的其他项目包括 Outlook 的连接器。查看该文件,有一个非常有前途的节点,名为 。我将此值为 true 的节点添加到 Channel 9 连接器,但没有成功。 (我什至尝试重新启动。)
  • 我遇到了一个一年前的问题几乎是同样的事情。接受的答案将我们引导至 Windows API 代码包,但它仅提供用于使用 Windows 搜索的类,而不是实现搜索提供程序。
  • 来自 Scott Hanselman 的注册表技巧。但是,此 (a) 仅固定一个链接来运行搜索,而不包含内联结果,并且 (b) 对我不起作用,因为我(我也不期望我的用户)拥有 Windows 7 Ultimate。

那么,如何向“开始”菜单的即时搜索提供项目?理想情况下,我只想配置要包含的搜索连接器的结果,但我不反对用 C# 连接一些将安装在客户端计算机上的内容。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

转角预定愛 2024-10-02 18:54:36

传统上,扩展 Windows 搜索的方法是通过 IFilters,它允许 Windows 识别新类型的文件。这种方法肯定会将您与“开始”按钮结果联系起来。

在这种情况下,您正在处理联合搜索,这使得在线内容就像存在于用户的计算机上一样。

不幸的是,我找不到任何可以明显解决你的问题的东西。因此,您可能必须分两部分构建一个组合:

  1. 用于搜索结果的 IFilter(例如“*.C9”文件)。
  2. 以“C9”结尾的文件。

顺便说一句,如果您对术语“IFilter”进行网络搜索并转到前几个搜索结果,您可能会认为由于页面顶部的注释而不再使用 IFilter。

如果发生这种情况,那么您位于旧的 IFilter 站点。有关此主题的 MSDN 文档的当前 URL 位于 http://msdn.microsoft.com/en-us/library/bb266451(v=VS.85).aspx

最后一点警告:

在 Windows 7 及更高版本中,以托管代码编写的筛选器被显式阻止。由于运行多个加载项的进程可能存在 CLR 版本控制问题,因此过滤器必须以本机代码编写。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文