我将 Sitecore 8.1 与 SOLR 搜索提供程序一起使用。当我执行搜索时,出现以下错误:
2480 2016:01:24 21:29:14 ERROR Solr Error : ["undefined field tags"] - Query attempted: [((_basetemplates_sm:(13789a2000bc4f77a98f40d0a2f18738) AND
-standardvalue_b:(True)) AND ((title_t:(*smoking*))^9 OR (abstract_t:
(*smoking*))^0.200000002980232 OR (articlefulltext_s:
(*smoking*))^0.200000002980232 OR (title_t:(*be*))^9 OR (abstract_t:
(*be*))^0.200000002980232 OR (articlefulltext_s:(*be*))^0.200000002980232 OR
(tags:(d4426cf378c14a97be3459cd9bfe569b))^0.100000001490116))]
我认为问题在于 Sitecore API 以某种方式发送了 tags 而不是 tags_sm。当我在 SOLR 管理门户查询字符串上手动更新此字段时,它会返回数据。
现在真正的问题是 Sitecore API 为什么/如何发送标签而不是 tags_sm。我查看了 web_index 核心上的 schema.xml,它有以下内容:
<field name="_tags" type="string" indexed="true" stored="true" multiValued="true" />
感谢您的帮助。
最佳答案
对于以 _
开头的所有字段,Sitecore 不会附加后缀(如 _sm
)。所以 Solr 中的字段将是 _tags
(您应该可以与 Luke 确认这一点)。
检查您的 SearchResultItem
类(您传递给 IQuerable
的类)是否具有 [IndexField("tags")]
的属性属性并将其更改为 [IndexField("_tags")]
。
同时回答您问题的另一部分 - 您永远不必担心 Solr 中的字段名称是什么。始终对 Sitecore 内置字段使用 Sitecore 配置中的内容。对于您自己的字段,请使用小写的名称。就是这样。
关于solr - Sitecore Solr 错误未定义字段标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34975519/