Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-76648

AssetEntryLocalServiceUtil.search methods take in an assetCategoryIds argument but do not use it



      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.


        Issue Links



              raven.song Raven Song
              michael.bowerman Michael Bowerman
              Kiyoshi Lee Kiyoshi Lee
              0 Vote for this issue
              2 Start watching this issue


                5 years, 22 weeks, 6 days ago


                  Version Package
                  7.0.0 DXP FP36
                  7.0.0 DXP SP7
                  7.0.5 CE GA6
                  7.1.0 M1