[TYPO3-Solr] Indexing custom table and sys_language_id

Prabin Dahal mr.prabin at gmail.com
Tue Mar 24 16:16:57 CET 2015


Hello,

I am trying to index custom table in solr for typo3 extension. Previously the custom table did not have sys_language_uid, l10n_parent and  l10n_diffsource. I added these columns with proper content. sys_language_id now holds 0 (Default) for German language and 1 for English language. l10n_parent is 0 and l10n_diffsource is NULL.

I modified TCA configuration accordingly. I have configured TCA as follows:


$TCA['tx_lsfmoduleguidesgb_modules'] = array (
        'ctrl' => array (
            'title'     => 'LLL:EXT:lsf_module_guidesgb/locallang_db.xml:tx_lsfmoduleguides_modules',        
            'label'     => 'uid',    
            'tstamp'    => 'tstamp',
            'crdate'    => 'crdate',
            'cruser_id' => 'cruser_id',
            'languageField' => 'sys_language_uid',
            'transOrigPointerField'    => 'l10n_parent',    
            'transOrigDiffSourceField' => 'l10n_diffsource',   
            'default_sortby' => 'ORDER BY crdate',    
            'delete' => 'deleted',    
            'enablecolumns' => array (        
                'disabled' => 'hidden',
            ),
            'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php',
            'iconfile'          => t3lib_extMgm::extRelPath($_EXTKEY).'icon_tx_lsfmoduleguides_modules.gif',
        ),
    );



Here is the typoscript to configure indexing of the table:


plugin.tx_solr.index.queue {
  tx_lsfmoduleguidesgb_modules = 1
  tx_lsfmoduleguidesgb_modules {
    table = tx_lsfmoduleguidesgb_modules
    #additionalWhereClause = sys_language_uid = GP : L
    fields {
      title = name
      description = SOLR_CONTENT

      description {
        field = content2
      }
      
      created = crdate
      changed = tstamp
     
      content = SOLR_CONTENT
      content {
        field = content
      }
    
      url = TEXT
      url {
        typolink.parameter = 555
        typolink.additionalParams = &sid={field:uid}&conf=2&extid=567&L={field:__solr_index_language}
        typolink.additionalParams.insertData = 1
        typolink.returnLast = url
        typolink.useCacheHash = 1
      }
    }
  }
}


The table is indexed properly and I can get the results when searched. The problem however is that I get results of both languages regardless of the L parameter. I tried the following typoscript to limit indexing:

[globalVar = GP:L = 1] 
plugin.tx_solr.index.queue.tx_lsfmoduleguidesgb_modules.additionalWhereClause = sys_language_uid = GP : L
[end]

It did not work so I knew it was not the way to do. :-)

How can I configure Solr for TYPO3 to return results for specific language? 

Also, If I have two tables which store data for specific language, is it possible to index the table for specific language?

I am using Solr for TYPO3 extension version 3.0.0, Solr version 4.8.1, TYPO3 version 4.5.32

Regards,
Prabin 


More information about the TYPO3-project-solr mailing list