solrsitecoresitecore8

Sitecore Solr Error undefined field tags


I am using Sitecore 8.1 with SOLR Search Provider. When I perform a search I am getting error below:

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))]

I believe the issue is that Sitecore API is somehow sending tags instead of tags_sm. When I manually update this field on SOLR Admin Portal query string, it returns data.

Now the real question is why/how the Sitecore API is sending tags instead of tags_sm. I had a look at schema.xml on web_index core, it has below:

<field name="_tags" type="string" indexed="true" stored="true" multiValued="true" />

Appreciate your help.


Solution

  • For all fields starting with _, Sitecore does not append suffixes (like _sm). So the field in Solr will be _tags (you should be able to confirm this with Luke).

    Check if your SearchResultItem class (the one you pass to IQuerable), has a property with [IndexField("tags")] attribute and change it to [IndexField("_tags")].

    Also answering the other part of your question - you should never worry about what is the field name in Solr. Always use what is in Sitecore configuration for Sitecore built-in fields. And for your own fields, use their names lowercase. That's it.