简体   繁体   中英

Sitecore, Solr, CommerceServer config issues

just finishing converting a Sitecore 8.2 (w/ CommerceServer) instance to use Solr instead of Lucene. I have been following this article here:

http://blog.alpha-solutions.us/2016/10/how-to-use-solr-with-sitecore-8-2-with-solr-6-the-easy-way/

At the end of the setup my site / CMS give me this error:

Server Error in '/' Application.

The given key was not present in the dictionary.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[KeyNotFoundException: The given key was not present in the dictionary.] System.Collections.Generic.Dictionary`2.get_Item(TKey key) +14331515 Sitecore.ContentSearch.SolrProvider.SolrFieldMap.AddFieldByFieldName(XmlNode configNode) +647

Any idea what this could be? I think maybe I am missing a config somewhere.

Thank you in advance.

Check in your Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config file or a custom index configuration if you have one. There will be a field map section like this:

      <fieldMap type="Sitecore.ContentSearch.SolrProvider.SolrFieldMap, Sitecore.ContentSearch.SolrProvider">
        <fieldNames hint="raw:AddFieldByFieldName">
          <field fieldName="Yourfield" returnType="string" />
        </fieldNames/>
      </fieldMap>

The configuration for the fields will be wrong somewhere.

If you have a custom index configuration be sure to make sure the fieldMap element is set up like this with a ref rather than a type:

 <fieldMap ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/fieldMap">

Make sure to include <typeMatches> before <fieldNames>.

<fieldMap ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/fieldMap">
  <typeMatches hint="raw:AddTypeMatch"></typeMatches>
  <fieldNames hint="raw:AddFieldByFieldName">
        ....
  </fieldNames>
</fieldMap>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM