Issue
-
Steps to Reproduce:
1) Go to Content > Document & Media.
2) Create a Folder(say Test Folder1) and inside that folder create one basic document(say Test Document1).
3) Now go to home page and search with keyword test.
4) Now click on Document Folder present on the left hand side.
5) Now click on the document folder i.e. Test Folder1. - Expected Result: The document present inside Test Folder1 should be displayed.
- Observed Result: No document is displayed.
Environment
- Liferay DXP 7.0
Resolution
-
The observed behaviour is by design.
There is a configuration called "View in Context" that can be enabled/disabled in the Search widget. The documentation describes it as follows:
View in Context
When an asset is clicked, show it in its native application. For example, if you click on a blog post in the search results, you’ll be taken to the page where the blog entry is posted in the Blogs application. Note that you will no longer be in the search context after clicking on a search result. When this option is unchecked, the asset displays in an Asset Publisher window while still in the search context. If you have the right permissions, you can even edit the content directly from the Search context. Click the back arrow to return to the search results.
So, if "View in Context" is enabled and there is a Document and Media widget on a page, then clicking on the folder in the search results will display it within its native application, the Document and Media portlet, thus giving its proper context.
If "View in Context" is disabled or no Document and Media is added to a site page, then clicking on the folder in the search results will display it in the context of the Search widget. The technical background is that the Search widget uses AssetRenderers to display the different asset types. E.g. DLFolders are rendered by DLFolderAssetRenderer which uses folder_full_content.jsp by default to display the folder details. This jsp file displays the most basic details by design:
- a folder icon
- the folder description (if exists)
- subfolders count
- documents count
- expando attributes (if exist)
To sum up, the observed behaviour is intentional. To provide proper context to the DLFolders returned as search results they can
- either use the "View in Context" feature to display in Document and Media or
- customize the folder_full_content.jsp file (with a JSP fragment module) according to their needs and leave rendering for Search widget.