【发布时间】:2015-02-13 17:05:47
【问题描述】:
我正在尝试从 Sitecore 的网络索引中排除所有克隆。我创建了一个继承自 Sitecore.ContentSearch.SitecoreItemCrawler 的自定义爬虫,并使用以下代码覆盖了 IsExcludedFromIndex 方法:
protected override bool IsExcludedFromIndex(SitecoreIndexableItem indexable, bool checkLocation)
{
if (indexable.Item["Hide from Search"] == "1")
return true;
if (indexable.Item.IsClone)
return true;
return base.IsExcludedFromIndex(indexable, checkLocation);
}
我的"Hide from Search" 字段有效:具有该字段集的任何项目都不包含在网络索引中。但是,indexable.Item.IsClone 永远不会为真,所有“克隆”都保留在网络索引中。
当我针对这个爬虫运行主索引时,IsClone 对于每个克隆都是正确的,并且它们不包含在索引中。我怀疑它适用于 master 而不是 web 索引,因为克隆在发布目标上进行了扩展 (as noted by John West)。
抱歉,如果这个问题被认为与 Globally exclude cloned items from index? 重复 - 那里的解决方案对我不起作用,我正在使用 SOLR(与 Lucene)和更新版本的 Sitecore,所以我相信这可能是单独的问题。
那么,如何从 Sitecore 7.2 Web(发布目标)数据库的 SOLR 索引中排除所有克隆?
【问题讨论】:
标签: solr sitecore sitecore7 sitecore7.2