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

When saving a ddmstructure, each JournalArticle version is indexed as many times as versions exists in each JournalArticle

    Details

      Description

      When saving a ddmstructure, each JournalArticle version is indexed as many times as versions exists in each JournalArticle.

      If you have a webcontent with 4 versions, we are indexing it 4*4=16 times.

      In 6.2.x similar error is produced when you configure journal.articles.index.all.versions=false in portal-ext.properties
      In that case if you have a webcontent with 4 versions, only last version is indexed but it is indexed 4 times

      Root cause

      In LPS-57161, Index buffer was applied to JournalArticleIndexer.reindexDDMStructures method, see following pulls:

      But in LPS-51356 call to "JournalArticleIndexer.reindexDDMStructures" method was moved from DDMStructureLocalServiceImpl to DDMStructureIndexerBackgroundTaskExecutor.
      This change causes this issue because in that background task there is no database transaction, so there is no Index Buffer that removes the duplicated requests to index.reindex(classname, resourcePK)

      Steps to reproduce (7.0.x and master)

      1. Create a structure
      2. Create a webcontent with 4 versions (versions 1.0 to 1.3) using the new structure
      3. Activate log category com.liferay.portal.search.internal.IndexWriterHelperImpl to DEBUG level
      4. Modify the structure and save it. A background reindex is launched
      5. Check log traces with DEBUG [liferay/background_task-1][IndexWriterHelperImpl] and count them:
        • Expected behavior: 4 lines with the requests to the index are written to the log
        • Wrong behavior: 16 lines with the requests to the index are written to the log
           

      Steps to reproduce (6.2.x)

      1. Configure journal.articles.index.all.versions=false in portal-ext.properties (only last version is indexed with this property)
      2. Create a structure
      3. Create a webcontent with 4 versions (versions 1.0 to 1.3) using the new structure
      4. Activate log category com.liferay.portal.kernel.search.SearchEngineUtil to DEBUG level
      5. Modify the structure and save it. A background reindex is launched
      6. Check log traces with DEBUG [liferay/background_task-1][IndexWriterHelperImpl] and count them:
        • Expected behavior: 1 lines with the request to the index is written to the log
        • Wrong behavior: 4 lines with the requests to the index are written to the log

       

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  1 year, 47 weeks, 6 days ago

                  Packages

                  Version Package
                  6.2.X EE
                  7.0.0 DXP FP33
                  7.0.0 DXP SP7
                  7.0.5 CE GA6
                  7.0.X
                  7.1.X
                  Master