This issue describes a SearchComponent for merging search results obtained from a DJoin distributed search (see SOLR-8234) as part of federated search - that is, distributed search over documents stored in separated instances of SOLR (for example, one server per continent), where a single document (identified by an agreed, common unique id) may be stored in more than one server instance, with (possibly) differing fields and data.
In the use of this search component, it is assumed that there is a single SOLR server (the "aggregator") that uses distributed search (shards=) to collect documents from other SOLR servers using DJoin (see SOLR-8234). The DJoin generates a result set containing parent documents each with child documents having the same unique id. This merge component turns each set of child documents into a single document conforming to the aggregator schema.
For example, suppose the aggregator schema defines a multi-valued integer field, 'num', and three shards return field values "48", 23, and "strawberry". Then the resulting merged field value would be [48, 23] and an error would included for the NumberFormatException.
Custom field merge behaviour may be specified by defining custom field types in the usual way and this is supported via a MergeAbstractFieldType class.