Broadleaf Microservices
  • v1.0.0-latest-prod

Indexing Translations


Translations are supported in search indexes (e.g. Solr Collection) and added to the documents when building or rebuilding an index. Since translations are based on a language and potentially dialects from a country or region, we provide settings to help determine the granularity of the translations stored in the index. The processing of translations on the index occurs in TranslationSolrDocumentBuilderContributor.

Translation Indexing Strategies

Below we’ll discuss our default strategy for indexing translations as well as the alternative approach, highlighting their pros and cons.

  1. Our default strategy is focused on performance of the index, since if there are many languages & country dialects available, this could increase the number of dynamic fields on an indexed document exponentially.

    • The translations that are indexed are only based on the language of the locales.

      • For example, this means that if the locales available are en, en-US, en-CA, fr, fr-CA, then the translations that will be indexed are en and fr.

      • This is gated by the property, index-country-specific-language-dialects.

    • The tenant’s default locale language is not indexed since the data indexed without a locale identifier will already be in the default locale.

      • For example, if the locales available are en and fr and the default locale of the tenant is en, then only the fr translations will be explicitly indexed.

      • Additionally, there is hook point to determine which translations should apply if language-based translations are not available for a field and there are multiple country dialects to choose from. See TranslationSolrDocumentBuilderContributor#applyDefaultSortOnLocaleTranslations.

      • This is gated by the property, index-languages-for-tenant-default-locale.

    • Note that with this approach of indexing only on the language, specific dialect translations will not be available for search & you may consider using synonyms, boosts, or other search config to curate your results.

  2. If the performance cost of indexing country dialects for languages is not an issue and searching on dialects is important for your business, this can be adjusted by changing the default values of the translation properties.

    • Configure the translation properties to enable country specific dialects & default tenant locale.

    • All translations will be indexed on the documents for languages, and language/country dialect conbinations.

    • For documents with a large amount of translatable fields & multiple country/language combinations, this will increase your indexing times. Consider scaling your hardware and/or configuring your search index (e.g. Solr) to account for this.