[MGNLEESOLR-149] FieldMapping indexer stops if mgnl:page contains the property Created: 15/Oct/20  Updated: 22/Oct/20

Status: Open
Project: Solr Search Provider
Component/s: None
Affects Version/s: 5.2.1, 5.5
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Antonio Tuor Assignee: Unassigned
Resolution: Unresolved Votes: 4
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

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)
Documentation update required:
Yes
Date of First Response:

 Description   

Problem

The logic of the current BasicSolrIndexService stops indexing a property from the fieldMappings if it's found on the node itself. This causes the property to be ignored on all childNodes e.g. Areas and Components.
See this if-loop.

Solution

Don't perfom this if check and always collect the properties of all childNodes and combine those results with the property of the indexed node:

String nodeType = config.getNodeType() != null ? config.getNodeType() : NodeTypes.Page.NAME;
Collection<String> childValues = this.getAllTextForNode(config.getWorkspace(), node, key, nodeType);
if (StringUtils.isNotBlank(value)) {
    childValues.add(value);
}
value = Jsoup.parse(StringUtils.join(childValues, ","), value).text();

This code bases on an additional adaption of the getAllTextForNode(...) method, which should always return an Array, even if it's empty, instead of returning null.


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