rombert commented on code in PR #111:
URL: 
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/111#discussion_r1434012781


##########
src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java:
##########
@@ -1148,19 +1148,26 @@ private boolean addEntry(final Map<String, 
List<MapEntry>> entryMap, final Strin
      */
     private Map<String, Map<String, Collection<String>>> loadAliases(final 
ResourceResolver resolver) {
         final Map<String, Map<String, Collection<String>>> map = new 
ConcurrentHashMap<>();
-        final String queryString = generateAliasQuery();
+        final String baseQueryString = generateAliasQuery();
 
-        log.debug("start alias query: {}", queryString);
-        long queryStart = System.nanoTime();
-        final Iterator<Resource> i = resolver.findResources(queryString, 
"JCR-SQL2");
-        long queryElapsed = System.nanoTime() - queryStart;
-        log.debug("end alias query; elapsed {}ms", 
TimeUnit.NANOSECONDS.toMillis(queryElapsed));
+        Iterator<Resource> it;
+        try {
+            final String queryStringWithSort = baseQueryString + " AND 
FIRST([sling:alias]) > '%s' ORDER BY FIRST([sling:alias])";
+            it = new PagedQueryIterator("alias", "sling:alias", resolver, 
queryStringWithSort,
+                    Integer.getInteger("sling.alias.pageSize", 2000));

Review Comment:
   This should come as an OSGi config, not as a system property. OSGi 
configuration properties can then be picked up from environment variables if 
desired, see 
https://github.com/apache/felix-dev/blob/master/configadmin-plugins/interpolation/README.md#interpolating-environment-variables
 .
   
   The OSGi config should have that default of 2000 set.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to