我使用以下代码添加了 ComputedIndexFields.config 文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<configuration>
<defaultIndexConfiguration>
<fields hint="raw:AddComputedIndexField">
<field fieldName="AppliedThemes" storageType="yes" indexType="TOKENIZED">be.extensions.AppliedThemes, be.extensions</field>
</fields>
</defaultIndexConfiguration>
</configuration>
</contentSearch>
</sitecore>
</configuration>
我还在所说的 assmlby 中添加了一个类:
namespace be.extensions
{
class AppliedThemes : IComputedIndexField
{
public string FieldName { get; set; }
public string ReturnType { get; set; }
public object ComputeFieldValue(IIndexable indexable)
{
Item item = indexable as SitecoreIndexableItem;
if (item == null)
return null;
var themes = item["Themes"];
if (themes == null)
return null;
// TODO
}
}
}
这是添加计算索引字段的基础。然而,当我添加这两个文件(类文件中的代码永远不会到达)时,当我打开内容编辑器时出现以下错误:
SearchConfiguration 配置不正确。ContentSearchConfiguration 是预期的,但返回了 System.String。
没有这个简单的配置文件一切正常。
有谁看到我在这里做错了什么或者知道我可以尝试解决这个问题吗?
编辑:我正在使用 Sitecore 8 Update 2