Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25827

Korean locale mismatch (ko_KR vs ko) causes existing pages to disappear from Solr search

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • None
    • 18.4.8
    • Search - Solr
    • None
    • Unknown

    Description

          1. Description

      Solr search does not return pages whose default language is `ko_KR`,
      although the pages are successfully indexed and can be found by querying
      the aggregate Solr fields (`title_`, `doccontent_`) directly.

      The issue disappears when the wiki default language is changed from
      `ko_KR` (Korean, South Korea) to `ko` (Korean) and a new page is created.

      This is potentially confusing because XWiki's localization UI allows
      `ko_KR` to be selected, while the Solr schema provides the Korean
      language-specific dynamic field for `ko`.

          1. Environment
      • XWiki: 18.4.8
      • Java: 21.0.13
      • Solr: Embedded Solr 9.4.1
      • Database: PostgreSQL
      • Wiki type: subwiki
      • Multilingual: enabled
      • Additional supported language: `en`
          1. Steps to reproduce

      1. Configure a wiki with:
         - Multilingual: enabled
         - Default language: Korean (South Korea), `ko_KR`
         - Supported language: English (`en`)

      2. Create a page with a unique title and body, for example:

         Title:

             RYUTITLE987654-V5

         Content:

             KOLANGTEST55667788

      3. Verify the document in the database.

         The document has:

             xwd_language = ''
             xwd_default_language = 'ko_KR'
             xwd_translation = 0

      4. Wait for automatic Solr indexing.

      5. Search for the title or body using the standard XWiki Solr search.

          1. Actual result

      The page is not returned by normal search.

      The generated Solr request contains:

          fq=locale"ko_KR" OR "")
          xwiki.supportedLocales=en,ko_KR
          qf=title ... doccontent ...

      and returns:

          hits=0

      However, the indexed data is present.

      Direct searches against the aggregate fields succeed:

          title_:"RYUTITLE987654-V5"

      and:

          doccontent_:"KOLANGTEST55667788"

      This indicates that document persistence and Solr indexing are working.

          1. Relevant Solr schema

      The generated schema contains a Korean language dynamic field for `ko`:

          <dynamicField name="*_ko"
                        type="text_ko"
                        multiValued="true"
                        indexed="true"
                        stored="true"/>

      It also contains the aggregate fields:

          <field name="title_"
                 type="text_general"
                 indexed="true"
                 stored="true"/>

          <field name="doccontent_"
                 type="text_general"
                 indexed="true"
                 stored="true"/>

      and:

          <copyField source="title_*" dest="title_"/>
          <copyField source="doccontent_*" dest="doccontent_"/>

      The XWiki Solr configuration uses:

          <str name="defType">xdismax</str>

      with:

          <str name="xwiki.multilingualFields">
            title, doccontent, doccontentraw, comment, objcontent,
            propertyvalue, attcontent, property., object.
          </str>

          1. Additional test

      I changed the wiki default language from:

          ko_KR

      to:

          ko

      and created a new page:

          KOTITLE99112233.WebHome

      The new page is stored as:

          xwd_language = ''
          xwd_default_language = 'ko'
          xwd_translation = 0

      The generated search request changed to:

          fq=locale"ko" OR "")
          xwiki.supportedLocales=en,ko

      and both the title and body were successfully returned by standard
      XWiki search:

          KOTITLE99112233 -> hits=1
          KOBODY99112233  -> hits=1

      The query uses the normal XWiki fields:

          qf=title^10.0 name^10.0
             doccontent^2.0
             ...

      The phrase fields also correctly contain:

          title_ko
          doccontent_ko

          1. Existing data impact

      In my test wiki, changing the wiki default language to `ko` doesn't
      migrate existing pages.

      For example, an existing page remains:

          xwd_language = ''
          xwd_default_language = 'ko_KR'
          xwd_translation = 0

      while newly created pages use:

          xwd_language = ''
          xwd_default_language = 'ko'
          xwd_translation = 0

      As a result, existing `ko_KR` pages remain missing from normal search
      after switching the wiki default language to `ko` until their locale
      metadata is migrated and they are reindexed.

          1. Expected result

      One of the following would be preferable:

      1. `ko_KR` should be handled correctly by XWiki Solr search if XWiki
         allows it to be selected as a wiki/page locale;

      2. `ko_KR` should be normalized to `ko` for Solr indexing and querying;

      3. XWiki should prevent selecting `ko_KR` when that locale is not
         supported by the Solr search schema; or

      4. XWiki should clearly warn administrators that selecting `ko_KR`
         can make pages unavailable through normal Solr search.

      Changing the wiki default locale should also provide a supported way
      to migrate the default locale of existing pages, or the documentation
      should explicitly explain the required migration/reindex procedure.

          1. Notes

      During troubleshooting:

      • PostgreSQL locks were ruled out.
      • Solr indexing events were generated normally.
      • Solr `/update` operations and commits were successful.
      • Latest page title and body were present and searchable through
          `title_` and `doccontent_`.
      • Reindexing did not solve the problem while the pages used `ko_KR`.
      • Recreating the `search_9` core with the XWiki 18.4.8 Solr server
          plugin did not fix existing `ko_KR` pages.
      • A newly created `ko` page worked immediately.

      This makes the locale mismatch the reproducible differentiator.

      Attachments

        Activity

          People

            Unassigned Unassigned
            donghyeon.ryu DonghyeonRyu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: