[TYPO3-Solr] indexqueue problems with multilang

Heiko Kromm | Paints h.kromm at paints.de
Fri Dec 2 16:51:32 CET 2011


I found a solution for this problem and would like to discuss if it is a bug. 

In tx_solr_indexqueue_RecordMonitor::processDatamap_afterDatabaseOperations the records from all monitored tables are added/updated to the index queue. 
If the record is a localized record, it will be put to the index queue as well. But it should not, because of the indexing behaviour of tx_solr_indexqueue_Indexer. 
The indexer searches for all items of the index queue for localized records and saves them with the id of the parent record. This is correct, but will create a duplicate in solr if a localized record is in the index queue. 
I think the localized records must not be added to the index queue. This will solve the problem. 

I solved this by checking if l10n_parent is set in tx_solr_indexqueue_RecordMonitor::processDatamap_afterDatabaseOperations. 
(Line 85) 
if (in_array($recordTable, $monitoredTables)) { 
// FIXME must respect the indexer's additionalWhereClause option: must not add items to the index queue which are excluded through additionalWhereClause 
// check if the record is an overlay 
if (isset($tceMain->checkValue_currentRecord['l10n_parent']) && $tceMain->checkValue_currentRecord['l10n_parent'] > 0) 
$recordUid = $tceMain->checkValue_currentRecord['l10n_parent']; 

$indexQueue->updateItem($recordTable, $recordUid); 
} 

Regards 
Heiko 



Von: "Heiko Kromm | Paints" <h.kromm at paints.de> 
An: typo3-project-solr at lists.typo3.org 
Gesendet: Donnerstag, 1. Dezember 2011 15:52:07 
Betreff: [TYPO3-Solr] indexqueue problems with multilang 

Hi list, 

I have a strange behaviour while indexing a custom table with the indexqueue. 
My website has 2 languages (german|0 and english|1) and a installed news-extension. 
In my solr-setup I tell the indexqueue to index the tx_news_domain_model_news table. 

plugin.tx_solr { 
index { 
queue { 
tx_news_domain_model_news = 1 
tx_news_domain_model_news { 
... my mappings here ... 
} 
} 
} 

This works fine for the german records but the english records are indexed twice. 
If I debug the solr results, there is one result with the correct english data and uid of the localized record. 
The second english result has the same english content, but the uid of the parent (german) data. 

I can reproduce this behaviour, if I empty the solr-index. 
Then I open the german record and change something. 
After a while the indexer does it's job and the german and the localized english record is indexed correctly. 
Now I open the english record and change something. 
Now the indexer creates the duplicate entry with the parent uid. 

Any ideas on this? 

Regards 
Heiko 
_______________________________________________ 
TYPO3-project-solr mailing list 
TYPO3-project-solr at lists.typo3.org 
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-solr 


More information about the TYPO3-project-solr mailing list