[TYPO3-Solr] Custom type extending normal "Pages" indexing

Søren Malling soren.malling at gmail.com
Thu Oct 3 12:14:23 CEST 2013


Hi,

I've has this usecase, where I'm using the "pages" table for articles on a
different doktype (110). My configuration looks like this

---------------

plugin.tx_solr.index.queue.articles = 1
plugin.tx_solr.index.queue.articles {
  table = pages
  initialization =
Bolius\BoliusProducts\Product\Indexqueue\Initializer\Article
  indexer = tx_solr_indexqueue_PageIndexer
  additionalWhereClause = doktype = 110 AND pid = 22
}

plugin.tx_solr.index.queue.pages.additionalWhereClause = doktype = 1 AND
no_search = 0

---------------

In my own initialization class it looks like this (extending Page
Initializer)

class Article extends \tx_solr_indexqueue_initializer_Page {

        public function __construct() {
                $this->type = 'pages';
                $this->indexingConfigurationName = 'articles';
        }

        public function setType($type) {
                $this->type = 'pages';
        }

        public function
setIndexingConfigurationName($indexingConfigurationName) {
                $this->indexingConfigurationName = 'articles';
        }
}

The reason that I'm using $this->type = 'pages' is that it still depends on
the "pages" TCA used in the Abstract initializer class.

If I'm using $this->type = 'articles' it tries to fetch records for the
indexqueue table I get a mysql error from the initial SQL

INSERT INTO tx_solr_indexqueue_item (root, item_type, item_uid,
indexing_configuration, indexing_priority, changed) SELECT '1' as root,
'articles' AS item_type, uid AS item_uid, 'articles' as
indexing_configuration, 0 AS indexing_priority, AS changed FROM articles
WHERE pid IN(LONG_LIST_OF_PIDS) AND doktype = 110 AND pid = 22

See, it uses $this->type as table name - even though I've added a
configuration setting for my indexqueue (table = pages)

So whatever I do, pages records with doktype 110 and pid = 22 are indexed
in Solr as type "pages", how come?

I'm using latest GIT version (3.0.0-dev)

Cheers

Søren


More information about the TYPO3-project-solr mailing list