ext-solr icon indicating copy to clipboard operation
ext-solr copied to clipboard

Relation does not take foreign match fields into account

Open dkd-friedrich opened this issue 8 years ago • 1 comments

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.

dkd-friedrich avatar Jul 15 '16 12:07 dkd-friedrich

Estimation:

Effort: 13 Value: 13

dkd-friedrich avatar Jul 15 '16 12:07 dkd-friedrich