1

I'm getting the error below.

I've removed the class itself just the config is present. Please guide!

Could not find the computed index field type: A.B.Indexing.Infrastructure.Fields.SearchResultFormatterComputedField, A.B.Indexing
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.InvalidOperationException: Could not find the computed index field type: Nexa.Foundation.Indexing.Infrastructure.Fields.SearchResultFormatterComputedField, Nexa.Foundation.Indexing

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:


[InvalidOperationException: Could not find the computed index field type: A.B.Indexing.Infrastructure.Fields.SearchResultFormatterComputedField, A.B.Indexing]
   Sitecore.ContentSearch.DocumentBuilderOptions.CreateComputedIndexfield(String fieldName, XmlNode configNode) +518
   Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions.AddComputedIndexField(XmlNode configNode) +80

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +132
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +146
   Sitecore.Configuration.DefaultFactory.AssignProperties(Object obj, Object[] properties) +853
   Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +641
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +326
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72
   Sitecore.Configuration.DefaultFactory.GetInnerObject(XmlNode paramNode, String[] parameters, Boolean assert) +109
   Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +545
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +326
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72
   Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert) +697
   Sitecore.Configuration.DefaultFactory.CreateFromReference(XmlNode configNode, String[] parameters, Boolean assert) +170
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +116
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72
   Sitecore.Configuration.DefaultFactory.GetInnerObject(XmlNode paramNode, String[] parameters, Boolean assert) +109
   Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +545
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +326
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72
   Sitecore.Configuration.DefaultFactory.GetInnerObject(XmlNode paramNode, String[] parameters, Boolean assert) +947
   Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +545
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +326
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72
   Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert) +697
   Sitecore.ContentSearch.ContentSearchManager.get_SearchConfiguration() +311
   Sitecore.ContentSearch.SolrProvider.SolrContentSearchManager.Initialize() +21

my config :

<contentSearch>
        <indexConfigurations>
            <defaultSolrIndexConfiguration type="Sitecore.ContentSearch.SolrProvider.SolrIndexConfiguration, Sitecore.ContentSearch.SolrProvider">
                <fieldMap type="Sitecore.ContentSearch.SolrProvider.SolrFieldMap, Sitecore.ContentSearch.SolrProvider">
                    <fieldNames hint="raw:AddFieldByFieldName">
                        <field fieldName="all_templates" returnType="stringCollection" />
                        <field fieldName="has_presentation" returnType="bool" />
                        <field fieldName="has_search_result_formatter" returnType="bool" />
                        <field fieldName="search_result_formatter" returnType="string" />
                    </fieldNames>
                </fieldMap>
                <virtualFields type="Sitecore.ContentSearch.VirtualFieldProcessorMap, Sitecore.ContentSearch">
                    <processors hint="raw:AddFromConfiguration">
                        <add fieldName="content_type" type="A.B.Indexing.Infrastructure.Fields.SearchResultFormatterComputedField, A.B.Indexing"/>
                    </processors>
                </virtualFields>
                <documentOptions type="Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions, Sitecore.ContentSearch.SolrProvider">
                    <fields hint="raw:AddComputedIndexField">
                        <field fieldName="has_presentation" storageType="no" indexType="untokenized">A.B.Indexing.Infrastructure.Fields.HasPresentationComputedField, A.B.Indexing</field>
                        <field fieldName="all_templates" storageType="no" indexType="untokenized">A.B.Indexing.Infrastructure.Fields.AllTemplatesComputedField, A.B.Indexing</field>
                        <field fieldName="has_search_result_formatter" storageType="no" indexType="untokenized">A.B.Indexing.Infrastructure.Fields.HasSearchResultFormatterComputedField, A.B.Indexing</field>
                        <field fieldName="search_result_formatter" storageType="no" indexType="untokenized">A.B.Indexing.Infrastructure.Fields.SearchResultFormatterComputedField, A.B.Indexing</field>
                    </fields>
                </documentOptions>
            </defaultSolrIndexConfiguration>
        </indexConfigurations>
    </contentSearch>

3 Answers 3

1

Computed fields are a great way of storing calculated (customized) information while Sitecore indexes your items. While implementing a computed index field mainly required code changes and configuration changes.

So if you remove the class your code has been removed but the configuration changes exist. I agree with @Marek that you need to remove the configuration to resolve it.

<field fieldName="search_result_formatter" storageType="no" indexType="untokenized">A.B.Indexing.Infrastructure.Fields.SearchResultFormatterComputedField, A.B.Indexing</field>

Just for knowledge of how computed index works refer to the below points.

  1. You need a class file.
public class MyComputedField : IComputedIndexField
{
    public object ComputeFieldValue(IIndexable indexable)
    {
        Item item = (Item) (indexable as SitecoreIndexableItem);
        
        var indexableItem = indexable as SitecoreIndexableItem;

        var item = indexableItem?.Item;
        
        //Your custom logic goes here.

    }

    public string FieldName { get; set; }

    public string ReturnType { get; set; }
}
  1. Configuration changes.
<fields hint="raw:AddComputedIndexField">
      <field fieldName="MyComputedField">
           MyNamespaceHere.ComputedFields.MyComputedField , MyNamespaceHere
      </field>
</fields>

I hope it provides clarity why you need to remove the configuration to resolve this error.

If you are still interested in deep dive refer to: Create a computed index field

1

This is totally correct to either add the class or remove the reference from config files. Have tries this way around, didn't worked for me!

I resolved the error by omitting this connection setting

<setting name="ContentSearch.ParallelIndexing.Enabled" value="true" />
0

If you removed the class, you have to remove reference to that class from the config as well.

Remove that line from your config:

<field fieldName="search_result_formatter" storageType="no" indexType="untokenized">A.B.Indexing.Infrastructure.Fields.SearchResultFormatterComputedField, A.B.Indexing</field>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.