有人知道如何将"UniqueID“属性映射到托管属性,以便在高级搜索结果中显示它吗?当我尝试使用共享服务管理中的元数据属性映射链接创建新的托管属性时,此属性不可见。
使用SiteData或Lists web服务,我可以看到"ows_UniqueId“属性,使用对象模型,我可以访问SPListItem.UniqueID属性-但我似乎找不到一种方法来将其映射到爬网/托管属性。
发布于 2010-10-12 22:58:58
这有点痛苦,而且可能不受支持,但以下是您需要做的,以使UniqueId成为爬行属性/映射属性,以便它可以包含在高级搜索结果中……
首先,您需要在内部更改要搜索的列表上的UniqueId字段,使其不再隐藏,并且可以由crawler进行索引。以下是一些示例对象模型代码:
// this is the identifier for UniqueId
Guid g = new Guid("4b7403de8d9443e89f0f137a3e298126");
// we will need these for reflection in a bit
BindingFlags bf = BindingFlags.NonPublic | BindingFlags.Instance;
using (SPSite s = new SPSite("http://SharePoint/")) {
  // grab the list that contains what you want indexed
  // and the UniqueId field from that list
  SPList l = s.RootWeb.Lists["Your Custom List/Library"];
  SPField f = l.Fields[g];
  // We need to call the private method SetFieldBoolValue
  // to allow us to change the Hidden property to false
  MethodInfo mi = f.GetType().GetMethod("SetFieldBoolValue", bf);
  mi.Invoke(f, new object[] { "CanToggleHidden", true });
  f.Hidden = false;
  f.Update();
}运行该代码(以及要覆盖的所有列表/库)后,您需要在Shared Services搜索管理中执行以下三个步骤:
完成第二次完全爬网后,应将数据填充到包含UniqueId的索引中。您可以通过修改搜索核心结果将其显示在高级搜索中:
打开editing
https://stackoverflow.com/questions/1432837
复制相似问题