gpt4 book ai didi

Windows 搜索 - IFilter 搜索词突出显示

转载 作者:可可西里 更新时间:2023-11-01 12:43:52 26 4
gpt4 key购买 nike

我的开发团队在为我们自己的自定义文件在 Windows 7 中显示搜索结果的文本片段时遇到了问题(请注意,我们不是在谈论使用 IPreviewHandler 界面的预览 Pane )。下面显示了我对 .txt 文件的含义的示例:

Search example

此处显示的带有突出显示结果的文本片段并未针对我们自己的文件显示,仅显示文件名。

我们已经为我们的文件实现了一个 IFilter,这可以正确地索引文件内容(搜索返回正确的结果)。它只是不会显示代码段并突出显示搜索词。

我们怀疑这可能与 IFilter 中 STAT_CHUNK 的 cwcStartSource 和 cwcLenSource 值有关,但将它们设置为不同的值到目前为止没有产生任何结果。

有没有人有过类似的经历或者有什么想法?

提前致谢。

最佳答案

您需要为您的文件类型生成预览处理程序。

It can also render enhanced previews of items in a Preview Pane without launching the default application, if the application has registered a Preview Handler. This can provide functionality such as file type-specific navigation (such a browsing a presentation using next/previous controls, or seeking inside a media file).[29] Preview handlers can also allow certain kind of selections (such as highlighting a text snippet) to be performed from the preview pane itself.

source

有大量 PDF 等代码示例。

在这里查看:CodePlex:Windows Preview Handler Pack

编辑:

澄清一下,Windows 7 中的搜索结果 Pane 是一个预览处理程序主机。它有两个主要部分:内容 View 和预览 Pane 。

Windows Explorer also includes a view mode called the Content view, which is the default view when viewing search results. The Content view shows the name, location, some of the metadata tags associated with the file, a thumbnail image of the file, and a snippet of the file. This view mode also uses hit highlighting to show where the query term appears in the files, which makes it easy to understand why that file was returned in the search results list.

source

如果您想要增强功能(例如查看自定义文件类型的文件内容),则需要任何自定义文件类型的预览处理程序。

In Windows Vista and later, Windows Search is integrated into all Windows Explorer windows for instant access to search.

...

Preview handlers and thumbnail handlers enable users to preview documents in Windows Explorer without having to open the application that created them.

source

要验证您是否正确实现了自定义文件类型,您可以尝试 File Type Verifier来自 Windows 7 SDK,它将测试与您的自定义文件相关的以下内容:

  • 预览处理程序
  • 缩略图处理程序
  • 属性处理程序
  • 动词处理程序
  • 过滤器(IFilter)
  • 友好协会
  • 感知类型
  • 重要属性

使用内容 View

you can take advantage of the Content view by using either of two different approaches. You can use an existing set of properties and layout pattern, or you can create your own combination. These two approaches are described in detail:

有关内容 View 的一般概述,请参阅这篇文章:

Content View By File Type or Kind

关于Windows 搜索 - IFilter 搜索词突出显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3934023/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com