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

Changing the default language of a document leads to duplicate search results

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Minor
    • None
    • 6.2.4
    • Search - Solr
    • Unknown

    Description

      Follow this steps to reproduce:

      • Enable multilingual with "en, fr" as supported languages. Leave "en" as default language of the wiki.
      • Create a new document and write some content. Save.
      • Search for this document. The document should appear only once in the list of results.
      • Edit the document and change the default language (from the Document information panel on the top right) from "en" to "fr". Save.
      • Search again for this document. The document appears twice in the list of results.

      Explanation: the id of the document in the Solr index is computed by DocumentSolrReferenceResolver#getId() from the document reference and the document real locale. Obviously if you change the document locale (e.g. by changing the default langauge of the default document translation) then the id of the Solr document changes and thus instead of updating an existing document from the index you are adding a new entry in the Solr index, thus the duplicate search results.

      I see two options:

      • Don't include the locale in the Solr index id for the default document translation. e.g. the default translation will always have the id wiki:Space.Page_ (no matter what the default local is) while the rest of the translations will have wiki:Space.Page_XX. This is in sync with XWikiDocument#getDocumentReferenceWithLocale() which uses the ROOT locale for the default translation.
      • Detect the change of the default locale in SolrIndexEventListener (on DocumentUpdatedEvent) and delete the old entry from the Solr index.

      Note that the workaround for now to get rid of the duplicate search results is to reindex the wiki.

      Attachments

        Activity

          People

            tmortagne Thomas Mortagne
            mflorea Marius Dumitru Florea
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: