Multilingual: Setup
Goal
The purpose of this article is to help you configure the multilingual functionality and to provide an easy step-by-step guide on how to configure the settings so that we can use this functionality.
Prerequisite
Install the Hawksearch Connector: Installing the Connector
Introduction to multilingual functionality: Multilingual: Overview
Steps set up the multilingual
Open the advanced settings: Administration → Settings → Advanced → Hawksearch
There you can find an option called “Enable Multilingual Support“ : check the boxRe-index your index. Go to Administration → Search Indexes. Find the one you’ll use and re-index it. Or create a new one and re-index it.
Create a page, where you place the HawksearchBox and HawksearchResults widgets.
Open the widget designer of the widgets and select your index.
Navigate to the front-end page with the widgets and there should be the option to select a language and when selecting a language the corresponding to this language results should be shown.
If we have only one language in the backend, then this menu is not displayed, even if it is an active multilingual, as there is no more than one selection option.
The page with the results should look like this:
Â
There should be a menu with the languages you’ve added and the initial results should correspond to the Default language. For changing the initial results language, the Default language in the backend should be changed.
Workbench changes
Add Visitor Targets for each of the languages in the Workbench of the engine. Navigate to the Engine → Workbench → Merchandising → Visitor Targets
Select Add Visitor Target and fill up the fields. Example is shown below:
The condition option should be selected and as value on the left the “Language“ should be selected and as value on the right the language abbreviation.
A Visitor target should be added for each of the language that are selected in the backend.Add Visibility Rules Navigate to the Engine → Workbench → Merchandising → Visibility Rules
Add visibility rules for the every language that is added as Visitor Target. Hide the language when the Visitor Target is not from the selected the given language.
Â
Autocomplete Configuration
Navigate to the Engine → Workbench → Keyword Search→ Auto-complete
Â
Click the Update Top Product
If existing remove any value for the Name/Value field. In this case - Title
Â
Click the Save button
Rebuild the index
In the Hawksearch Box or Hawksearch results (SPA Mode) widget designer Data field, add the {"_suggestionItem":{"titleField":"field-name"}} to the Data object. For the value of the titleField, you must enter the field that you want to perform the autocomplete search without the language suffix, e.g. title
Â
Click Save
Publish the page
Facet visualization when using the multilingual functionality
Enabling the multilingual and reindexing the items, changes also the way the fields are named. Most of the fields receive a language suffix. The suffix is concatenated underscore (“_“) and the 2 letter (“en“) language abbreviation.
Example:
contenttypename → contenttypename_en
title → title_ru
Therefore, the association of fields to facets may need to be changed. If you need to visualize a facet with the content type then you will have to make as many facets as there are languages ​​selected (and for which there are items).
Example: if English, German and Russian are selected and there are items in these languages, when indexing these articles, the document fields will receive extensions in the respective language. Thus, the article in German will not have field contenttypename, but contenttypename_de, the article in English will have contenttypename_en, and so on.
Accordingly, there is no way to have one facet associated with the content field, because in this case we will not have such a field, and three other fields with suffixes (contenttypename_en, contenttypename_de, contenttypename_en).
Therefore, it is necessary to make 3 facets associated with the respective fields + language.
In this way we will not only see the facets correctly, but they will also be specific to the different languages. So if we don't have blogs in German, when selecting German Blogs won't appear as a facet, but if we do have in English, when selecting English they will be displayed as a selection option.
Be aware that when the multilingual option is enabled, the association of fields to facets may need to change.
Queryable
One more time it is important to mention that the fields are changed when documents are indexed in the multilingual context. And if any of the fields, different from “content“ and “title“, are marked as queryable then after indexing, this fields are changed (suffix added). So these new fields (the one with suffixed) should also be marked in the Workbench as Queryable.
Â