[TYPO3-Solr] Images in search results

Rik Willems rik at actiview.nl
Tue Oct 4 16:04:51 CEST 2011


Hi Michiel,

I wasn't this far yesterday. I was still testing through the 
fieldRenderingInstructions to find right sizes.
So, this morning I wanted to do the same as you. And failed. The reason 
is that cObjects are frontend. For TEXT and CONTENT this is not much of 
a problem but IMAGE gets confused with paths.

After a long search and debug I found this link [1]. Basically you fool 
the script by pointing to another directory.

Adding this to the indexer script and you get a fine result [2]. Can you 
shine a light on any implications this solution might have?

[1] 
http://blog.netzelf.de/lang/de/tipps-und-tricks/tslib_cobj-image-im-backend

[2] File classes/indexqueue/class.tx_solr_indexqueue_indexer.php line 321

	protected function resolveFieldValue(tx_solr_indexqueue_Item $item, 
array $itemRecord, $solrFieldName) {
		$itemIndexingConfiguration = $this->getItemTypeConfiguration($item);
		$fieldValue                = '';

		if (isset($itemIndexingConfiguration[$solrFieldName . '.'])) {
				// configuration found => need to resolve a cObj
			$cwd = getcwd();
			chdir(PATH_site);
			$this->contentObject->start($itemRecord, $item->getType());
			$fieldValue = $this->contentObject->cObjGetSingle(
				$itemIndexingConfiguration[$solrFieldName],
				$itemIndexingConfiguration[$solrFieldName . '.']
			);
			chdir($cwd);
		} else {
			$fieldValue = $itemRecord[$itemIndexingConfiguration[$solrFieldName]];
		}

		return $fieldValue;
	}

Cheers!


On 3-10-2011 23:30, Michiel Roos wrote:
> Hi Rik,
>
> I have attempted this (adding uri to resized image) recently and failed.
> No I use the fieldRenderingInstructions, but that sucks performance wise
> (paging through the result set while not all images have been thumbed is
> @#W)#$%*% slow).
>
> So if you can document your working TS here and on the wiki, that would
> be great.
>


More information about the TYPO3-project-solr mailing list