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

    Details

      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

            Activity

              People

              Assignee:
              raven.song Raven Song
              Reporter:
              michael.bowerman Michael Bowerman (Inactive)
              Participants of an Issue:
              Recent user:
              Csaba Turcsan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 48 weeks, 6 days ago

                  Packages

                  Version Package
                  7.0.0 DXP FP36
                  7.0.0 DXP SP7
                  7.0.5 CE GA6
                  7.0.X
                  7.1.0 M1
                  7.1.X
                  Master