0

我正在为我的文件格式开发一个自定义过滤器。<propkey.h>当我使用来自like的任何系统键时,一切正常PKEY_Search_Contents

但现在我需要有我的自定义属性来注册和使用 Windows 搜索。想象:

"SELECT * FROM SystemIndex WHERE scope ='file:C:/' AND Publisher.Item.CustomProperty LIKE '%Test%'"

我看到了 Property Handlers 并且已经测试过了。我使用了RecipePropertyHandlerWindows 7 SDK 示例中的项目。当我用这段代码搜索时:

// get a property store for the mp3 file
IPropertyStore* store = NULL;
HRESULT hr = SHGetPropertyStoreFromParsingName(L"SomePath",
    NULL, GPS_DEFAULT, __uuidof(IPropertyStore), (void**)&store);

hr = HRESULT_FROM_WIN32(GetLastError());

PROPVARIANT variant;
store->GetValue(PKEY_Microsoft_SampleRecipe_Difficulty, &variant);

//// very important undocumented method
store->Release();
CoUninitialize();

我收到正确的答案。

但我不明白如何联合IFilterIPropertyStore创建我的自定义属性。要开始我的IFilter,我使用了来自 的示例Windows 7 SDK Samples。我正在做类似的事情:

chunkValue.SetTextValue(PKEY_SearchContents, filtered.c_str(),CHUNK_TEXT, 1046, 0, 0, CHUNK_EOS);

我再也找不到链接了,但是我读到了 msdn 的一段关于你不能一起实现IFilterAND的引用IPropertyStore。这是真的吗?换句话说,我不能创建自定义属性?

我看到了来自 msdn 的所有链接,例如linklink2或任何其他链接。我可以做单独的事情,但我不知道如何将两者结合起来。

任何想法如何实施?

编辑

我正在尝试实现 PropertyHandler。我的 .propdesc 文件有以下内容:

-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://schemas.microsoft.com/windows/2006/propertydescription"
        schemaVersion="1.0">
  <propertyDescriptionList publisher="Microsoft" product="SampleRecipe">
    <propertyDescription name="Microsoft.SampleRecipe.Difficulty" formatID="{1794C9FE-74A9-497f-9C69-B31F03CE7EF9}" propID="100">
      <description>This property indicates the preparation difficulty of a recipe.</description>
      <searchInfo inInvertedIndex="true" isColumn="true" />
      <typeInfo type="String" multipleValues="false" isViewable="true" />
      <labelInfo label="Recipe difficulty" invitationText="Specify recipe difficulty" />
      <displayInfo displayType="Enumerated" >
        <editControl control="DropList"/>
        <enumeratedList>
          <enum value="Easy" text="Easy" />
          <enum value="Medium" text="Medium" />
          <enum value="Hard" text="Hard" />
        </enumeratedList>
      </displayInfo>
    </propertyDescription>
    <propertyDescription name="Microsoft.SampleRecipe.Keywords" formatID="{16D19FCB-7654-48AB-8057-DF8E51CC0755}" propID="100">
      <description>This property indicates the preparation difficulty of a recipe.</description>
      <searchInfo inInvertedIndex="true" isColumn="True"/>
      <typeInfo type="String" multipleValues="true" isViewable="true" />
      <labelInfo label="Recipe Keywords" invitationText="Specify recipe keyword" />
    </propertyDescription>
  </propertyDescriptionList>
</schema>

在 Windows 属性上:

我从文件中收到所有信息...但是当我尝试使用 Windows Search 进行搜索时,例如:

SELECT Microsoft.SampleRecipe.Keywords FROM SystemIndex 

其中目录='somedirectory'

我收到所有行都是空的...任何想法为什么?

编辑

我可以在 PropSchema 上看到我的属性:

我可以在我的 WSSQL 查询上使用我的 Microsoft.SampleRecipe.DifficultyV2,例如:

SELECT Microsoft.SampleRecipe.KeywordsV2 FROM SystemIndex WHERE directory='C:\users\step\documents\rvffilter\'

但是所有的内容都是空的

4

0 回答 0