- Turn on staging with page versioning on public pages
- Add a Web Content Display portlet on a page in the staging site
- Create an article and display it in the WCD portlet – assert that a row was added to journalcontentsearch table accordingly
- Now remove the WCD portlet from the page
- Query journalcontentsearch table
Result: The row for the article still exists in the journalcontentsearch table. Due to this, calling e.g. JournalContentSearchLocalServiceUtil.getLayoutIds(article.getGroupId(), false, article.getArticleId()) for the article will still return the layoutId, despite the article is not display on the page revision currently.
Since page versioning is turned on, any modification on the page will create a new layout revision accordingly. However, journalcontentsearch entries are not tied to the actual layout revision, they are linked to the original layout entity with the groupId-privateLayout-layoutId values. We have to link them to the revision using plid.