reschke commented on code in PR #81: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/81#discussion_r961653653
########## src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java: ########## @@ -1275,25 +1276,40 @@ private static boolean isAliasValid(String alias) { return invalid; } + private Iterator<Resource> queryAllVanityPaths(String query) { + log.debug("start vanityPath query: {}", query); + long queryStart = System.nanoTime(); + final Iterator<Resource> i = resolver.findResources(query, "JCR-SQL2"); + long queryElapsed = System.nanoTime() - queryStart; + log.debug("end vanityPath query; elapsed {}ms", TimeUnit.NANOSECONDS.toMillis(queryElapsed)); + return i; + } + /** * Load vanity paths - search for all nodes (except under /jcr:system) * having a sling:vanityPath property */ private Map<String, List<String>> loadVanityPaths(ResourceResolver resolver) { final Map<String, List<String>> targetPaths = new ConcurrentHashMap<>(); - final String queryString = "SELECT [sling:vanityPath], [sling:redirect], [sling:redirectStatus]" + " FROM [nt:base]" + final String baseQueryString = "SELECT [sling:vanityPath], [sling:redirect], [sling:redirectStatus]" + " FROM [nt:base]" + " WHERE NOT isdescendantnode('" + queryLiteral(JCR_SYSTEM_PATH) + "')" + " AND [sling:vanityPath] IS NOT NULL"; + final String queryStringWithSort = baseQueryString + " ORDER BY FIRST([sling:vanityPath]), [jcr:path]"; - log.debug("start vanityPath query: {}", queryString); - long queryStart = System.nanoTime(); - final Iterator<Resource> i = resolver.findResources(queryString, "JCR-SQL2"); - long queryElapsed = System.nanoTime() - queryStart; - log.debug("end vanityPath query; elapsed {}ms", TimeUnit.NANOSECONDS.toMillis(queryElapsed)); + boolean supportsSort = true; + Iterator<Resource> i; Review Comment: ack -- 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