TYPO3-Solr / ext-solr

A TYPO3 extension that integrates the Apache Solr search server with TYPO3 CMS. dkd Internet Service GmbH is developing the extension. Community contributions are welcome. See CONTRIBUTING.md for details.
GNU General Public License v3.0
136 stars 246 forks source link

[BUG] EXT:solrfal: url lacks absRefPrefix #3953

Open kitzberger opened 4 months ago

kitzberger commented 4 months ago

Describe the bug

When indexing files via "page context" the url property of the documents in the solr index lack the absRefPrefix (a.k.a. a single leading slash).

Expected behavior

URLs for files should have the same absRefPrefix that page documents have as well.

Used versions (please complete the following information):

dkd-kaehm commented 4 months ago

@kitzberger Thanks for reporting, the issue is known and tracked in EXT:solrfal private repository. As far as I know all versions are affected. The TYPO3 core behaves different on some place by resolving the relative/absolute path in CLI and Web contexts. I'll add the infos about source of trouble as soon I'm confronting with it again.

dkd-kaehm commented 4 months ago

Most probably the fix in the core is required. But @kitzberger if you can, please debug to the source of TYPO3 core back and add infos here. Thanks

kitzberger commented 4 months ago

@dkd-kaehm, here's what I found out today while debugging this:

In the core there's an event GeneratePublicUrlForResourceEvent that is being dispatched when creating the public URLs of FAL records. Both EXT:frontend and EXT:solrfal are listening to that, but ...

Maybe EXT:solrfal could simply register EXT:frontend's listener when on TYPO3_MODE=CLI?

            // Make sure all FAL resources are prefixed with absPrefPrefix
            $this->listenerProvider->addListener(
                GeneratePublicUrlForResourceEvent::class,
                PublicUrlPrefixer::class,
                'prefixWithAbsRefPrefix'
            );