ext-solr
ext-solr copied to clipboard
Relation does not take foreign match fields into account
Bart Lammers wrote:
When using 'relation' in the Solr indexing configuration, this relation does not take the foreign_match_field into account.
I found this when trying to index file references between News and FAL (fal_media) field. The sys_file_reference table is used for a multitude of references between various tables, and all that match the local and foreign id's in this case, are retreived.
(Not quite optimised) solution could be:
Classes/ContentObject/Relation.php : around line 165
if (!empty($localFieldTca['config']['foreign_match_fields'])) { $foreignMatchFields = $localFieldTca['config']['foreign_match_fields']; foreach ($foreignMatchFields as $foreignMatchField => $foreignMatchValue) { $whereClause .= ' AND (' . $foreignTableName . '.' . $foreignMatchField . ' = "' . $foreignMatchValue . '")'; } }
https://forge.typo3.org/issues/66050
Since sys_file_reference stores relations to several tables and fields I think that "foreign_match_fields" and "foreign_table_field" have to be considered.
Estimation:
Effort: 13 Value: 13