Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page Indexer: Bug during File Reference Indexing #150

Closed
cepheiVV opened this issue Mar 22, 2023 · 0 comments · Fixed by #217
Closed

Page Indexer: Bug during File Reference Indexing #150

cepheiVV opened this issue Mar 22, 2023 · 0 comments · Fixed by #217

Comments

@cepheiVV
Copy link
Contributor

The method getPageContent() in class /Classes/Indexer/Types/Page.php loads FileReferences and Links within a foreach loop into a variable $fileObjects.

If your Indexer configuration contains multiple RTE field, e.g:
Screenshot 2023-03-22 at 10 54 08

The foreach loop will override the $fileObjects variable, thus only the links of last RTE field will be indexed.

// index content of this content element and find attached or linked files.
// Attached files are saved as file references, the RTE links directly to
// a file, thus we get file objects.
// Files go into the index no matter if "index_content_with_restrictions" is set
// or not, that means even if protected content elements do not go into the index,
// files do. Since each file gets its own index entry with correct access
// restrictions, that's no problem from an access permission perspective (in fact, it's a feature).
foreach ($contentFields as $field) {
    $fileObjects = array_merge(
        $this->findAttachedFiles($ttContentRow),
        $this->findLinkedFilesInRte($ttContentRow, $field)
    );

    $content .= $this->getContentFromContentElement($ttContentRow, $field) . "\n";
}

// index the files found
if (!$pageAccessRestrictions['hidden']
    && $this->checkIfpageShouldBeIndexed($uid, $this->pageRecords[(int)$uid]['sys_language_uid'])
    && !empty($fileObjects)
) {
    $this->indexFiles($fileObjects, $ttContentRow, $pageAccessRestrictions['fe_group'], $tags);
}

In this example configuration, when $this->indexFiles() is executed, the variable $fileObjects will be empty, even if the RTE field bodytext contains links.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant