[TYPO3-Solr] additionalWhereClause with subselect prevents items from being added to the index on creation

Jonas Götze jonnsn at gmail.com
Fri Apr 19 13:13:46 CEST 2013


Hi all,

I have a standard configuration for indexing tt_news items with an 
additionalWhereClause to index only news of certain categories:

addtionalWhereClause = tt_news.deleted=0 AND tt_news.hidden=0 AND 
tt_news.uid IN (SELECT mm.uid_local FROM tt_news_cat_mm mm WHERE 
mm.uid_foreign IN(4,8))

4 and 8 are the uids of the allowed categories.

If I create new Items that belong to one of these categories, they are 
not added to the index.
Solr Extension is 2.8.2 from TER, TYPO3 4.5.25.

I looked in the code at class.tx_solr_indexqueue_recordmonitor.php, 
function processDatamap_afterDatabaseOperations and found out, that the 
variable $record in line 189:
$record = $this->getRecord($recordTable, $recordUid);
is empty.
If there is no record found there, the item will not be added to the index.

I digged deeper and made some debug in the function getRecord (line 238).
I stored the last built query there and executed it manually - and it 
gave me the expected result but in the code (=at runtime) the same query 
gives no result.
The Query is:
SELECT * FROM tt_news WHERE uid=8 AND tt_news.deleted=0 AND (SELECT 
tt_news_cat_mm.uid_local FROM tt_news_cat_mm WHERE 
tt_news_cat_mm.uid_local = tt_news.uid AND tt_news_cat_mm.uid_foreign IN 
(4,8)) > 0

Does anyone have a Clue why this is happening? It seems like the 
relations in the mm_tables are added later...

Thanks for reading!

Regards
Jonas


More information about the TYPO3-project-solr mailing list