是否可以使用适用于自定义文件格式的过滤器处理程序扩展Windows搜索索引? [英] Is It possible to extend Windows search index with a filter handler that works with a custom file format?

查看:148
本文介绍了是否可以使用适用于自定义文件格式的过滤器处理程序扩展Windows搜索索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上我希望索引适用于某些自定义文件类型。对于某些自定义文件格式,我需要实现过滤器或属性处理程序以将文件内容和属性编入索引。我用谷歌搜索了一些与之相关的样本,但我找不到任何有用的东西。虽然我从msdn得到了一篇文章,讨论如何扩展windows的索引。

http://msdn.microsoft.com/en-us/library/bb318649%28VS.85%29.aspx [ ^ ]

解决方案

< blockquote>对我来说也是一个有趣的问题。这肯定不是最佳解决方案(如果我正确理解它),可能是一种解决方法或帮助研究。



我已经阅读了你的链接特别是IFilter接口和ISearchCatalogManager是尝试测试它的好点。



http://msdn.microsoft.com/en-us/library/windows/desktop/dd940428%28v=vs.85% 29.aspx



http://msdn.microsoft.com/en-us/library/cc678933%28v=vs.85%29.aspx [ ^ ]



我首先尝试手动方式,所以我在Windows Registry \HKEY_CLASSES_ROOT \中添加了一个自定义文件类型,我以.tkz为例。您可以在.txt文件中看到一些包含以下属性的示例设置:





\HKEY_CLASSES_ROOT \.txt包含字符串(标准)/(默认),值为txtfile,内容类型(文本/普通)和感知类型(文本)



\HKEY_CLASSES_ROOT \.txt \ OpenWithList - - 用命名链接打开.txt(在我的情况下,Dreamweaver在那里作为字符串链接)



\HKEY_CLASSES_ROOT \.txt \ OpenOpenPithIds - 也替代打开的应用程序(在选择要打开的txt文件时将显示在上下文中使用...打开)。在我的例子中,Visual Studio和Open Office都有值。



\ HEKY_CLASSES_ROOT \ .txt \ PersistandHandler - >重要的是因为它包含代表COM类的CLSID以及文件扩展名。



http://msdn.microsoft.com/en-us/library/ms692491%28v=vs.85%29.aspx [ ^ ]



\HEKY_CLASSES_ROOT \.txt \ ShellNew - 对我们来说不是那么重要。



好吧,所以我创建了一个自定义扩展,然后我很快就使用了Windows搜索并搜索了我的扩展名* .tkz。在搜索之后,我查看了

Windows索引选项(运行control.exe srchadmin.dll),我的自定义文件在Advanced->文件类型中成功编入索引。



它有点脏,但是在注册表中插入一个带有字符串和值的新扩展并在此之后用Windows进行短搜索将是一件容易的事。我还没有尝试过以编程方式执行此操作。



我有兴趣测试的第二点是尝试使用方法AddCatalog()来使用Index-Management-Interfaces。也许它会按照上面的步骤搜索我们上面的自定义文件之后不必要的。



http://msdn.microsoft.com/en-us/library/windows/desktop/ee872086%28v=vs.85%29 .aspx [ ^ ]



希望它以任何方式推动您的研究。



最诚挚的问候
$ b $bBjörn


你不应该这样做。

不是因为我这么说,而是因为Microsoft确实在此输入链接描述。



重要在Windows 7及更高版本中,显式阻止使用托管代码编写的过滤器。过滤器必须用本机代码编写,因为多个加载项运行的过程可能会出现CLR版本问题。



如果您决定不使用Windows 7,那么你仍然可以使用其中一个实现框架,如iFilterCode来制作一个。但它必须始终通过Interop,这在速度上是一个相当不错的打击。


Actually I want the indexing to work for some custom file types. For some custom file formats, I need to implement a filter or property handler to have file content and properties indexed . I googled it to get some samples relating to it but I could not find anything useful. Although I got an article from msdn which talks about extending the indexes for windows.
http://msdn.microsoft.com/en-us/library/bb318649%28VS.85%29.aspx[^]

解决方案

Also interesting question for me. This is surely not the optimal solution (in case I'm understanding it correctly), maybe something like a workaround or help with research.

I've read your link and especially the IFilter interface and ISearchCatalogManager are good points to give a try to test it.

http://msdn.microsoft.com/en-us/library/windows/desktop/dd940428%28v=vs.85%29.aspx

http://msdn.microsoft.com/en-us/library/cc678933%28v=vs.85%29.aspx[^]

I first tried it the manually way, so I've added a custom file type in Windows Registry \HKEY_CLASSES_ROOT\ , I've taken .tkz for example. You can see some sample settings in .txt file which contains Properties like this:


\HKEY_CLASSES_ROOT\.txt contains string (Standard)/(Default) with value txtfile,Content Type (text/plain) and perceived Type(text)

\HKEY_CLASSES_ROOT\.txt\OpenWithList -- to open .txt with named links (in my case Dreamweaver is linked there as string)

\HKEY_CLASSES_ROOT\.txt\OpenWithProgIds -- also "alternative" applications to open with (will be displayed in context menue when selecting a txt-file to open "Open with..."). In my case there are values from Visual Studio and Open Office.

\HEKY_CLASSES_ROOT\.txt\PersistandHandler --> Important because it holds the CLSID that represents a COM class and also a file name extension.

http://msdn.microsoft.com/en-us/library/ms692491%28v=vs.85%29.aspx[^]

\HEKY_CLASSES_ROOT\.txt\ShellNew -- not so important for our case.

okay, so I've created a custom extension, then I've quickly used Windows search and searched for my extension *.tkz. After searching for it I had a look into
Windows indexing options (run control.exe srchadmin.dll) and my custom file was successfully indexed in Advanced->File Types.

It's a bit dirty, but it would be an easy task to insert a new extension in registry with strings and values and doing a short search with windows after this. I've don't tried it yet to do this programmatically.

A second point I got interested to test is trying to use the Index-Management-Interfaces with method AddCatalog(). Maybe it would be doing our above step to search after our custom file above needless.

http://msdn.microsoft.com/en-us/library/windows/desktop/ee872086%28v=vs.85%29.aspx[^]

Hope it drives forward your researching in any way.

With Best Regards
Björn


You should not be doing this.
Not because I say so, but because Microsoft does enter link description here.

Important 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.

If you decide not to use Windows 7, you can still use one of the implementation frameworks like iFilterCode to make one. But it will have to go through Interop all the time which is a pretty decent hit in speed.


这篇关于是否可以使用适用于自定义文件格式的过滤器处理程序扩展Windows搜索索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆