mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for ALF-5032: findAuthorities() getting slow when many groups are created.
- moved to PARENT driven queries where possible in preference to PATH git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@23246 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -360,16 +360,38 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
|
||||
}
|
||||
if (parentAuthority != null)
|
||||
{
|
||||
query.append(" AND PATH:\"/sys:system/sys:authorities/cm:").append(ISO9075.encode(parentAuthority));
|
||||
if (!immediate)
|
||||
if(immediate)
|
||||
{
|
||||
query.append('/');
|
||||
// use PARENT
|
||||
NodeRef parentAuthorityNodeRef = getAuthorityNodeRefOrNull(parentAuthority);
|
||||
if(parentAuthorityNodeRef != null)
|
||||
{
|
||||
query.append(" AND PARENT:\"").append(LuceneQueryParser.escape(parentAuthorityNodeRef.toString())).append("\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new UnknownAuthorityException("An authority was not found for " + parentAuthority);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// use PATH
|
||||
query.append(" AND PATH:\"/sys:system/sys:authorities/cm:").append(ISO9075.encode(parentAuthority));
|
||||
query.append("//*\"");
|
||||
}
|
||||
query.append("/*\"");
|
||||
}
|
||||
if (zoneName != null)
|
||||
{
|
||||
query.append(" AND PATH:\"/sys:system/sys:zones/cm:").append(ISO9075.encode(zoneName)).append("/*\"");
|
||||
// Zones are all direct links to those within so it is safe to use PARENT to look them up
|
||||
NodeRef zoneNodeRef = getZone(zoneName);
|
||||
if (zoneNodeRef != null)
|
||||
{
|
||||
query.append(" AND PARENT:\"").append(LuceneQueryParser.escape(zoneNodeRef.toString())).append("\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new UnknownAuthorityException("A zone was not found for " + zoneName);
|
||||
}
|
||||
}
|
||||
sp.setQuery(query.toString());
|
||||
sp.setMaxItems(100);
|
||||
|
Reference in New Issue
Block a user