[TYPO3-Solr] Custom / extend Indexer for pages

Michal Cygankiewicz mc at amtsolution.pl
Mon Jul 4 10:02:35 CEST 2016


Hi,
I have a question about extending Indexer functionality. It is possible to extends IndexQueue class for custom records, for example:

class MySolrIndexer extends \Tx_Solr_IndexQueue_Indexer {
    public function index(\Tx_Solr_IndexQueue_Item $item) {
        $record = $item->getRecord();
        $record['testRecordField'] = 'test';
    $item->setRecord($record);
        return parent::index($item);
    }
}
In this case I'm able to use new field in typoscript, such as:
plugin.tx_solr.index.queue.my.fields.testField_stringS = TEXT
plugin.tx_solr.index.queue.my.fields.testField_stringS.value = testRecordField

It works fine for any records, except pages. Here I tried to extend PageIndexer:

class MyPagesIndexer extends Tx_Solr_IndexQueue_PageIndexer {
    public function index(\Tx_Solr_IndexQueue_Item $item) {
        $record = $item->getRecord();
        $record['testRecordField'] = 'test';
        $item->setRecord($record);
        return parent::index($item);
    }
}

But then I'm unable to use this new field:
plugin.tx_solr.index.queue.my.fields.testField_stringS = TEXT
plugin.tx_solr.index.queue.my.fields.testField_stringS.value = testRecordField
All records have now empty field testField.
Is there anything that blocks this functionality for pages?


More information about the TYPO3-project-solr mailing list