Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-48695

Search result may come from a different locale than the user is currently on, when the user is searching for the category title



      === Initial steps

      1- Create an article with title "fish article" and content "fish". Add the French translation for this article with title "article de poisson" and content "poisson".
      2- Create a category with English (US) and French titles: "fishing" = "pĂȘche"
      3- Assign this category to the article
      4- Add Search & Language portlets to a page
      5- Switch locale to French

      === Scenario 1

      6- Search for the category title in French ("pĂȘche"):
      Actual result The article is found, but the summary (title & content snippet) in the result is displayed in English
      Expected result The article is found, and the summary also comes in French.

      === Scenario 2

      7- Add WC Search portlet to the page
      8- Repeat step 6.
      Actual result The article is not found.
      Expected result The article is found.

      9- Switch back to US locale
      10- Search for the category in English ("fishing"):
      The article is found.

      Technical note In this example, the article's default locale is "en_US", that's why the you get results from French locale even if you are searching for a term that occurs in the US version only. The article's non-localized default fields (CONTENT, DESCRIPTION, TITLE) holds the values belonging to the article's default locale, and these fields are part of the search query (unless you are performing and advanced search).


      === Changes done in this fix
      0- We already stored the asset category titles of a given Web Content in the indexed Document with all available locales in fields like "assetCategoryTitles_en_US", "assetCategoryTitles_fr_FR" etc before this fix. All search queries performed from the Search portlet contained both the localized and non-localized assetCategoryTitles fields, where the locale postfix is the user's current display locale.

      1- After this fix, we attempt to get "snippet" from the assetCategoryTitles fields as well, in order to use it to generate the Summary for each WC. More precisely, to get the correct locale.
      2- If we find matches only in in the localized assetCategoryTitles field, but there is no translation available in the given locale for that particular WC, the snippet locale (== summary's locale) will be the default locale of that WC. We do this to avoid empty summaries in the UI. Otherwise, the summary's locale will be equal to the user's display locale.
      3- We display a language flag for each assets in the result list if its locale is different than the current display locale. (See LPS-48695-Search-Portlet-UI-result-form-with-lang-flag.png
      4- Users/administrators are now able to search for assets/users/organizations etc. by categories on their localized form from the admin search boxes. It means, if e.g. there is a user categorized with a category that has 2 translations (US, FR), and the display locale is French, the user can be found by searching for the French category title.


        1. fix.jpg
          50 kB
        2. LPS-48695.png
          117 kB
        3. LPS-48695-Search-Portlet-UI-result-form-with-lang-flag.png
          114 kB
        4. reproduce.jpg
          62 kB

          Issue Links



              lu.liu Lu Liu
              tibor.lipusz Tibor Lipusz
              Participants of an Issue:
              Recent user:
              Marta Elicegui
              0 Vote for this issue
              3 Start watching this issue


                Days since last comment:
                6 years, 45 weeks ago


                  Version Package
                  6.2.3 CE GA4
                  6.2.X EE
                  7.0.0 M1