Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Search Portlet: how to search documents only under a specific folder
Hi, I am using Liferay 6.2 and I am customizing search portlet. I have developed a couple of custom assets and I configured the portlet to search only for these entities, in this way:
It works but now I need that, when a user perform a search, only documents under a specific folder are returned (ie: only docs in "MyDocs" folder or in any subfolders) so in the hooked main_search.jsp page I added the following line
But it doesn't work! I am still able to search document in folders out of MyDocs subtree, and looking at the generated query , it doesn't contains any directive to restrict the search...
What I am missing?
thanks in advance,
Marco
{"facets": [
{
"displayStyle": "asset_entries",
"weight": 1.5,
"static": false,
"order": "OrderHitsDesc",
"data": {
"values": [
"com.liferay.portlet.documentlibrary.model.DLFileEntry",
"com.liferay.portlet.documentlibrary.model.DLFolder",
"com.nttdata.nos.maps.model.Processo",
"it.saving.nos.org.model.Structure"
],
"frequencyThreshold": 1
},
"label": "asset-type",
"className": "com.liferay.portal.kernel.search.facet.AssetEntriesFacet",
"fieldName": "entryClassName"
},
.....
It works but now I need that, when a user perform a search, only documents under a specific folder are returned (ie: only docs in "MyDocs" folder or in any subfolders) so in the hooked main_search.jsp page I added the following line
searchContext.setFolderIds(folderIds);
where folderIds is an array containing all ids of MyDocs folder and any subfolder.But it doesn't work! I am still able to search document in folders out of MyDocs subtree, and looking at the generated query , it doesn't contains any directive to restrict the search...
What I am missing?
thanks in advance,
Marco
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™