If you are seeing the following Exception when accessing the Index Manager in Sitecore it is likely you have errors within your Index configuration files.
Could not create instance of type: Sitecore.ContentSearch.LuceneProvider.Analyzers.DefaultPerFieldAnalyzer. No matching constructor was found.
The Source
The likely source of the issue is that a custom DefaultIndexConfiguration
config file in the /App_Config/Includes/
folder is erroneous.
When creating the custom DefaultIndexConfiguration
the likely developer copied the entire content of the Sitecore.ContentSearch.Lucene.DefaultIndexConfiguration.config
file similarly to how you create a custom ContentSearch Index. However only a small subset of the DefaultIndexConfiguration.config
is needed to create a custom one.
To identify which of your custom IndexConfigurations are causing the issue, besides opening and viewing the xml, remove them all from the Includes folder and add each one until the Index Manager throws the exception.
The Solution – Create a Custom DefaultIndexConfiguration file
Your custom IndexConfiguration file only need a few of the lines from the out-of-the-box Sitecore.ContentSearch.Lucene.DefaultIndexConfiguration.config
or Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config
, depending if you are using Lucene or Solr, to work. Below I have example of the minimum required to get your custom one working. This works for both Lucene and Solr for this example I am using Lucene.
You can swap out any of the required configuration settings for any custom configurations, types or analyzers you create.
If you need you can customise any area of the DefaultIndexConfiguration by copying the XML in and modifying it, such as Field Type Mapping, Computed Fields, Include and Exclude fields and more!
Finally don’t forget to reference your new custom index configuration in the indexes that should use them via the configuration xml node.
And that’s it
Resolved the Server Error on the Index Manager and created a custom IndexConfiguration.
Using a custom one really is valuable when you are having a highly bespoke search or only searching certain types of Items and/or small number of Fields. You can create really lean indexes vastly improving search performance.
