Uploaded image for project: 'Solr Search Provider'
  1. Solr Search Provider
  2. MGNLEESOLR-139

Bug in SingleSolrSearchResultTransformer when transforming search results

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Neutral
    • None
    • 5.2.2

    Description

      Follow SUPPORT-10649:

      Error occurs inĀ 

      info.magnolia.search.solrsearchprovider.logic.result.SingleSolrSearchResultTransformer

      on the line

      anAbstract = (String)solrDocument.getFieldValue("abstract");

      The result of getFieldValue is in this case an ArrayList of 1 value. All my fields return an ArrayList.

      Investigation shown that "abstract" field was configured to use "text_general" fieldType:

      <field name="abstract" type="text_general"/>
      

      While text_general fieldType was configured as "multiValued":

      <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100" multiValued="true">
      

      Also from Javadoc of Solr function getFieldValue of a SolrDocument may return a single value or a collection of values:

      Object org.apache.solr.common.SolrDocument.getFieldValue(String name)
      
      Get the value or collection of values for a given field.
      

      However when implementing function info.magnolia.search.solrsearchprovider.logic.result.SingleSolrSearchResultTransformer.transform(SolrDocument, Collection<?>) we casted a single String object to get its result:

      String anAbstract = (String) solrDocument.getFieldValue("abstract");
      

      This is a bug when implementing the module, please fix it accordingly. Any workaround or suggestion are welcome!

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              viet.nguyen Viet Nguyen
              DeveloperX
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Checklists

                  Bug DoR
                  Task DoD