4

We upgraded our solution from 9.0.2 to 9.2 and now our search queries using a class that overrides SearchResultItem and having properties that use an [IndexField] attribute to set the name of field in the index are not working anymore on Solr. It does work with Azure Search.

In the logs we see that the queries are executed but the IndexField attribute is not used so we get the error that the field does not exist:

ERROR Solr Error : ["undefined field activitytype"] - Query attempted:

Weird thing is that it does work for the fields in the ootb SearchResultItem and also for one of our own fields in the same class – the only difference I can detect is that the working fields is a ComputedIndexField.

1 Answer 1

5

Adding the fields in the fieldMap solved the issue.. not sure why (indexAllFields is true)

<contentSearch>
    <indexConfigurations>
      <defaultSolrIndexConfiguration>
        <fieldMap>
          <fieldNames hint="raw:AddFieldByFieldName">
            <field fieldName="activitytype" returnType="stringCollection" />
            <field fieldName="..." returnType="stringCollection" />
            <field fieldName="..." returnType="stringCollection" />
            <field fieldName="..." returnType="stringCollection" />
          </fieldNames>
        </fieldMap>
      </defaultSolrIndexConfiguration>
    </indexConfigurations>
</contentSearch>

We only had to do this for Solr - with Azure Search it works without any additional configuration. It also worked on 9.0.2.. this change was needed in our 9.2 solution.

1
  • 1
    Note: on a 10.2 version I still had to do this...
    – Gatogordo
    Commented Feb 23, 2023 at 13:55

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.