vivion34 发表于 2015-9-30 07:18:42

用HtmlProp.dll处理Sharepoint 搜索日起类型Metadata的问题

  我们在目前的项目中间使用了Sharepoint Portal作为索引引擎去crawling我们的MCMS (Microsoft Content
  Management) 网站上的内容。 MCMS上的内容我们用了一些Meta tag.但是我们发现Sharepoint Portal 搜索引擎在索
  引这些Meta Data的时候,不能够很好处理日期类型的Meta Data.例如:

  在某些网页上,有一些Meta tag如:
  <META content=&quot;2005-1-1&quot; name=&quot;N.eventstartdate&quot;>
<META content=&quot;2005-1-20&quot; name=&quot;N.eventenddate&quot;>
  
当我们用Sharepoint Search Service,并使用类似
  &quot;urn:schemas.microsoft.com:htmlinfo:metainfo:DATE&quot; < GetGMTDate()
  
的Query语句去查询,得不到任何结果。同样,在Sharepoint Portal的Advanced Search中,也得不到任何结果。

  Sharepoint Portal的搜索引擎crawling和Indexing网站或网页内容的时候,使用了一种叫IFilter的技术。例如使用
  了nthtml.dll作为HTML IFilter处理HTML的内容。但是,nthtml.dll不能够自动转换类似&quot;2005-1-1&quot;的内容到日期
  型.所以用日期型去查询讲得不到任何结果.
  
在微软的Platform SDK中有一个IFilter的例子叫HTMLProp能很好的处理日期类型的Meta tag.用它来替代nthtml.dll将能解决上述搜索的问题.下面是我安装HTMLProp.dll的步骤:
  
1. 编译HTMLProp.dll的例子 (在Platform SDK中能找到)

2. 拷贝HTMLProp.dll到 C:\Windows\System32.

3. 拷贝HTMLProp.ini到 C:\Windows\System32.

4. 修改HTMLProp.ini为
  
n.eventstartdate (VT_FILETIME) = d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1 n.eventstartdate
n.eventenddate (VT_FILETIME) = d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1 n.eventenddate
  
5. 停下Microsoft SharepointPS Search Service和正在clawling的Job.

6. 打开Registry,修改 HKLM\SYSTEM\CurrentControlSet\Control\ContentIndex\DLLsToRegister,加入一行 C:\WINDOWS\system32\htmlprop.dll

7. 运行 &quot;regsvr32.exe %windir%\System32\HtmlProp.dll&quot;.

8. 找到HKLM\SOFTWARE\Microsoft\SPSSearch\ContentIndexCommon\Filters\Extension\.htm 和 HKLM\SOFTWARE\Microsoft\SPSSearch\ContentIndexCommon\Filters\Extension\.html,把原值 {E0CA5340-4534-11CF-B952-00AA0051FE20} 替换为 {f4309e80-a1db-11d1-a8fb-00e098006ed3}

9. 察看HKLM\SOFTWARE\Microsoft\SPSSearch\ContentIndexCommon\Filters\CLSID\ 下的所有Key, 把值 {E0CA5340-4534-11CF-B952-00AA0051FE20} 全部替换为 {f4309e80-a1db-11d1-a8fb-00e098006ed3}

10. 在 Sharepoint Portal 的 Site Settings 中, 选择 &quot;Manage Properties of Crawled Content&quot;, 删除 urn:schemas.microsoft.com:htmlinfo:metainfo:N.eventstartdate 和 urn:schemas.microsoft.com:htmlinfo:metainfo:N.eventenddate。

11. Reset 所有的 Content Indexes.

12. Full update 所有的 Content Indexes.

13. 在 &quot;Manage Properties of Crawled Content&quot;中,打开 urn:schemas.microsoft.com:htmlinfo:metainfo:N.eventstartdate 和 urn:schemas.microsoft.com:htmlinfo:metainfo:N.eventenddate 并选择 &quot;Included in the Advanced Search&quot;.

14. 重新 Reset 和 Full update 所有的 Content Indexes.
  
日期类型的Metadata 就能够很好的工作了.
页: [1]
查看完整版本: 用HtmlProp.dll处理Sharepoint 搜索日起类型Metadata的问题