JournalContentSearchLocalServiceUtil.getLayoutIds returns an empty list
written-by
Daniel Martinez Cisneros
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
legacy-article
learn-legacy-article-disclaimer-text
Issue
- When trying to retrieve the pages where a web content article is displayed using its
articleId, an empty list is returned.
- After instantiating a web content in a Content Viewer, the following method is used to obtain the
layoutIds:
List<Long> layoutIds = JournalContentSearchLocalServiceUtil.getLayoutIds(themeDisplay.getScopeGroupId(), false, articleId);
- The search returns an empty list. Checking the database, the
JOURNALCONTENTSEARCH table has not been updated and there is no record relating the page to the web content.
- However, if the following method is executed before the call described above:
JournalContentSearchLocalServiceUtil.checkContentSearches(themeDisplay.getCompanyId());
- The
JOURNALCONTENTSEARCH table is updated, reflecting the relationship between the page and the web content selected in the content viewer.
Environment
- Liferay DXP 7.4 before update 64
Resolution
- The
JournalContentSearch table is not used directly in DXP versions 7.4 update 64 and later. An internal refactoring was performed, and this information is now stored in the LayoutClassedModelUsage table.
- The commit in which this change was executed is linked to the Jira LPS-174322.
- Although calling
JournalContentSearchLocalServiceUtil.checkContentSearches(themeDisplay.getCompanyId()); populates the JournalContentSearch table, this table is no longer updated automatically by the product. The updated information is found in the LayoutClassedModelUsage table.
- Use the following method to obtain the corresponding information:
LayoutClassedModelUsageLocalServiceUtil.getLayoutClassedModelUsages(...)
did-this-article-resolve-your-issue