我正在使用Sitecore 8.1和SOLR Search Provider . 当我执行搜索时,我收到以下错误:
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" />
感谢您的帮助 .
2 回答
对于以
_
开头的所有字段,Sitecore不会附加后缀(如_sm
) . 因此,Solr中的字段将是_tags
(您应该能够通过Luke确认这一点) .检查
SearchResultItem
类(传递给IQuerable
的类)是否具有[IndexField("tags")]
属性的属性并将其更改为[IndexField("_tags")]
.同时回答你问题的另一部分 - 你永远不应该担心Solr中的字段名称是什么 . 始终使用Sitecore配置中的Sitecore内置字段 . 对于您自己的字段,请使用小写字母 . 而已 .
将根据字段类型添加_sm标记 . 检查Sitecore.ContentSearch.Solr.DefaultIndexConfiguration和/ sitecore / contentSearch / indexConfigurations / defaultSolrIndexConfiguration / FieldMap / typeMatches中的元素
这里的id列表映射到typeName =“guidCollection”中的[fieldName] _sm . 检查您的配置是否具有此“_sm”扩展名 . 如果确实如此,您可能需要检查“fieldNames”的 Map 是否包含标记字段名称,以便它不会获得正确的后缀 .
如果更改配置,请记住重建索引 .