[TYPO3-Solr] Indexing custom table with nested relations

Samir Rachidi sr at plusb.de
Mon Mar 17 11:40:11 CET 2014


Hey Martin,

thank you for the TypoScript-trick with the markers. I tried to use it, but it did not work in the first place, so I discontinued this solution (now I see my mistake ;-) ). But I think the most flexible and (for me) easiest way was realising it with a custom indexer.

The custom indexer will handle all the indexing magic the tx_solr extension normally does and you can override every method of this class. I override the function, where the conversion from a database-item to an Apache_Solr_Document is done:

protected function itemToDocument(tx_solr_indexqueue_Item $item, $language = 0) { 
$document = parent::itemToDocument($item, $language);

//special treatment for $item-Object fields

return $document;
 }

Hey Olivier,

yes, i found a possibility to define a foreignLabelField. So, I could specify one field to include into the index (see the example above), e.g. something like person.lastname, but i needed a way to specify multiple fields e.g. like person.firstname, person.lastname and a glue-string, which would connect both parts. I realised this with a custom indexer. Now my field is indexed with content structured like "[person.firstname] [person.lastname]".

Or did I overlook something?


More information about the TYPO3-project-solr mailing list