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

Organization search returns no results when there are a high number of organizations (> 1024) assigned to the current user

    Details

    • Fix Priority:
      5

      Description

      Reproduction steps for master/6.2.x

      1. Login with Test Test
      2. Create a new User "OrgAdmin" (It's important to test it with a user who is not a company admin, othwerwise DB searches will be performed instead of index-search.)
      3. Create a new Organization "Engineering"
      4. Create another Organization "Support"
      5. Assign user "OrgAdmin" to both organizations
      6. Grant "Organization Administrator" role to "OrgAdmin" on both organizations
      7. Add more permissions to "Power User" in order to let "OrgAdmin" to go to Control Panel/Users & Orgs:
       
      Portal: Go to Control Panel
      Users and Organizations: Access in Control Panel
      Users and Organizations: View
      

      Get the userId of "OrgAdmin" from the details page of Edit User and the organizationId of both organizations from your DB

      1. Go to Control Panel/Server Administration Script tab
      2. Execute the following code as a Groovy script (don't forget to replace "$userId" & "$parentOrganizationId", and change the name to something else before the 2nd run!): first create 1025, secondly 2001 sub-organizations:
      	import com.liferay.portal.kernel.util.StringPool;
      	import com.liferay.portal.model.ListTypeConstants;
      	import com.liferay.portal.model.OrganizationConstants;
      	import com.liferay.portal.service.OrganizationLocalServiceUtil;
      	import com.liferay.portal.service.ServiceContext;
      
      	final int countryId = 18;
      	final String name = "TSE";
      	// final String name = "Core";
      	final long parentOrganizationId = $parentOrganizationId;
      	final boolean recursable = false;
      	final long regionId = 0l;
      	final long userId = $userId;
      
      	ServiceContext serviceContext = new ServiceContext();
      
      	serviceContext.setIndexingEnabled(false);
      
      	for (int i = 0; i <= 1025; i++) {
      		OrganizationLocalServiceUtil.addOrganization(
      			userId,
      			parentOrganizationId,
      			name + i,
      	        OrganizationConstants.TYPE_REGULAR_ORGANIZATION,
      	        recursable,
      			regionId,
      	        countryId,
      			ListTypeConstants.ORGANIZATION_STATUS_DEFAULT,
      			StringPool.BLANK,
      			false,
      	        serviceContext);
      	}
      
      1. Go to Control Panel/Server Administration Resources tab
      2. Reindex all search indexes
      3. Log in with "OrgAdmin" or impersonate him
      4. Go to Admin/Control Panel
      5. Note the followings:
      • The "Browse" tab says: "Showing 1 - 20 of 3,030 results."" --> Total number seems valid so far.
      • Search for any organization name that appears on the page --> Resul
      • Search for organization "Support" on the "Browse" tab --> No result.
      • The "All Organizations" tab says "Showing 1 - 20 of 1,024 results." --> Seems incorrect.
      • Search for organization "All Organizations" on the "All Organizations" tab --> No result.

      Company admin (Test Test) is able to search for any organization.

      (For you convenience, see the screencast attached.)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                tibor.lipusz Tibor Lipusz
                Reporter:
                tibor.lipusz Tibor Lipusz
                Participants of an Issue:
                Recent user:
                Esther Sanz
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  5 years, 16 weeks ago