Multi Language Handling¶
A multi core setup allows to use one index (core) per language and/or environment. Additional information on multi core can be found in the Apache Solr wiki.
Recommended naming scheme for TYPO3 Solr cores in solr.xml¶
[dev|live]-[UpperCamelCase site root page title]-[site root page id]-[system language uid]-[locale]
Example:
Suppose we have a site for ACME Inc., the site's root page ID is 1, the default language (0) is english, german (sys_language_uid 1), and french (sys_language_uid 2) are alternative languages. We would then set up cores with these names:
live-AcmeInc-1-0-en_US live-AcmeInc-1-1-de_DE live-AcmeInc-1-2-fr_FR dev-AcmeInc-1-0-en_US dev-AcmeInc-1-1-de_DE dev-AcmeInc-1-2-fr_FR
This defines names for four cores, two for the live site, two for the dev site. Page ID 1 is the root page of the US site, 2 is the german site's root page ID. 0 is the sys_language_uid for the default language, 1 represents german. The last part defines the locale, for example for german there exists also swiss german (de_CH) and austrian german (de_AT).
The locale is constructed of the lower-case, two-letter ISO Language Code as defined by ISO-639, followed by an underscore, followed by the upper-case, two-letter ISO Country Code as defined by ISO-3166.
Switching cores depending on the FE language (L parameter)¶
Since the Solr connection is defined in TypoScript you then simply change it using a condition. Usually you only change the path since the server likely is the same.
Example:
plugin.tx_solr.solr {
host = localhost
port = 8080
path = /solr/live-AcmeInc-1-0-en_US/
}
[globalVar = GP:L = 1]
plugin.tx_solr.solr.path = /solr/live-AcmeInc-1-1-de_DE/
[end]
[globalVar = GP:L = 2]
plugin.tx_solr.solr.path = /solr/live-AcmeInc-1-2-fr_FR/
[end]