[MGNLEESOLR-139] Bug in SingleSolrSearchResultTransformer when transforming search results Created: 29/Nov/19  Updated: 13/Dec/23

Status: Accepted
Project: Solr Search Provider
Component/s: None
Affects Version/s: 5.2.2
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Viet Nguyen Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: y2k
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: Support
Team: DeveloperX

 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!


Generated at Mon Feb 12 11:00:29 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.