Details
-
Bug
-
Status: Closed
-
Resolution: Fixed
-
7.0.X, Master
-
7.0.x
-
Committed
-
1
-
3
Description
Description
Various search methods in AssetEntryLocalServiceUtil take in an assetCategoryIds argument. Eventually, the created SearchContext's _assetCategoryIds field is populated with this argument (after being turned into a long array). However, the SearchContext's _assetCategoryIds field does not actually get used during the search. So no matter what you set the assetCategoryIds argument as, the search results will always be the same.
Steps to Reproduce
1. Start up Liferay on a fresh database and log in as the admin user.
2. On the default "Liferay" site, add a new Category (Liferay > Content > Categories).
3. On the default "Liferay" site, add three new Bookmarks (Liferay > Content > Bookmarks).
4. Assign the category you added in step 2 to TWO of the bookmarks you added in step 3. Leave the third bookmark alone.
5. Navigate to Control Panel > Configuration > Server Administration > Script.
6. Paste the contents of the attached testAssetCategoryLocalServiceUtilSearchMethod.groovy script into the box.
7. Edit the line String assetCategoryIds = "34102";, replacing 34102 with the categoryId of the Category you added in step 2.
8. Execute the groovy script while observing the console output.
Expected Result: The console outputs "2 bookmarks entries were returned", since you only have two bookmarks entries assigned to that category.
Actual Result: The console outputs "3 bookmarks entries were returned", indicating that the search did not filter by the category as you directed it to.
When I tested this in master, there was a UI bug that made it impossible to assign a category to a bookmarks entry. So I did steps 1-4 in Liferay DXP, then upgraded the database to master before proceeding with steps 5-8.
Attachments
Issue Links
- relates
-
LPS-76729 Can't extend Category folder when select categories for content
- Closed