hmmh / typo3-solr-file-indexer

TYPO3 Extension: solr_file_indexer
GNU General Public License v3.0
11 stars 7 forks source link

No FileProcessingAspect defined during indexing #47

Closed b3nkai closed 1 year ago

b3nkai commented 1 year ago

Hi !

I have a little issue during indexing. The issue is a little specific because I store the rendered template in solr with a FLUIDTEMPLATE :

plugin.tx_solr.index.sys_file_metadata.fields { render_stringS = SOLR_CONTENT render_stringS.cObject = FLUIDTEMPLATE render_stringS.cObject { stdWrap.htmlSpecialChars = 1 extbase.controllerExtensionName = site_search templateName = File/Index/File templateRootPaths { 10 = EXT:site_search/Resources/Private/Templates/ } partialRootPaths { 10 = EXT:site_search/Resources/Private/Partials/ } layoutRootPaths { 10 = EXT:site_search/Resources/Private/Layouts/ } dataProcessing { 10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor 10 { if.isTrue.field = tx_site_image references.table = sys_file_metadata references.fieldName = tx_site_image as = images } } } }

Everything is working fine, the small problem is when I call the f:image ViewHelper in the fluid template, the fileProcessingAspect is not defined in context so TYPO3 use the DeferredBackendImageProcessor. So the file processing is deferred and this kind of URL is stored in solr :

/typo3/image/process?token=6cae7f95b0a3e4ca461e19931c17a31e116b9b17&id=645

Instead of storing the processed image url, like this :

/fileadmin/processed/f/2/csm_my_picture_e8a6fc34c5.png

Fixing the issue is simple, we just have to set a FileProcessing aspect before indexing :

$context = GeneralUtility::makeInstance(Context::class); $context->setAspect('fileProcessing', new FileProcessingAspect(false));