如何将索引 属性 添加到站点以便我可以构建一个结果源来搜索所有站点的内容 属性

How to Add Indexed Property to a Site So I can build a result source to search all sites for content with this property

我想构建一个仅包含部分网站集和子网站的 Sharepoint 在线搜索结果源。我有超过 5000 个网站集,所以我不能在结果源中使用命名 URLs/site id - 不可维护。相反,我希望在配置站点后将索引 属性 添加到站点的 属性 包中,然后将托管 属性 映射到它,并在结果源中使用它来过滤搜索结果以仅匹配在具有该 属性 值的网站中找到的内容。 Phil Harding 的文章描述了这种方法:https://platinumdogs.me/2015/02/06/set-a-propertybag-property-as-indexed-queryable-via-search-using-csom-powershell/ and Mike Morawski adds some code for the indexed property encoding - http://www.migee.com/2015/09/14/allowing-property-bag-values-to-be-searched-via-sharepoint-search/ 我使用了两者的一些来实现这种方法。

方法:

  1. 将键 = 'SiteType'、值 = 'MySiteType' 添加到 Web 所有属性
  2. 将具有 'MySiteType' 值的索引 属性 'SiteType' 添加到 Web IndexedProperties (vti_indexedpropertykeys)。密钥编码为 base64
  3. 在搜索架构中手动添加托管 属性 'propSiteType' 映射到 'SiteType' 抓取 属性。

我已经通过 Powershell+CSOM 完成了 1 和 2,并验证站点 属性 已添加并已被抓取。 Managed 属性 存在,但它在 ResultSource 构建器对话框中不可用,并且任何搜索如 {searchterms} propSiteType:MySiteType 或 (contentclass:STS_Web OR contentclass:STS_Site) propSiteType:MySiteType没有return的结果。

想法或替代方法?提前致谢

我唯一的想法是索引延迟。我看到 O365 需要几天时间来索引新内容,甚至 manually requesting a crawl 时也是如此。如果那是问题所在,那么现在可能已经解决了。您是否看到相关的搜索结果?

https://www.sharepointnutsandbolts.com/2013/10/waiting-for-search-crawl-in-office-365.html