reschke commented on code in PR #245:
URL:
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/245#discussion_r4724255339
##########
src/main/java/org/apache/sling/resourceresolver/impl/mapping/AliasHandler.java:
##########
@@ -210,6 +216,31 @@ private void execute() {
}
}
+ // Returns an iterator over resources with a sling:alias property,
+ // using paged sorting when enabled and falling back to an unpaged
query.
+ @NotNull
+ private Iterator<Resource> getQueryIterator(@NotNull ResourceResolver
resolver) {
+ String baseQueryString = generateAliasQuery();
+ Iterator<Resource> it;
+ if (PAGING_BEHAVIOUR == QueryBuildHelper.UNPAGED_QUERY) {
+ log.debug("query behaviour is set to unpaged");
+ it = queryUnpaged(baseQueryString, resolver);
+ } else {
+ try {
+ String queryStringWithSort =
+ baseQueryString + " AND FIRST([sling:alias]) >=
'%s' ORDER BY FIRST([sling:alias])";
+ it = new PagedQueryIterator("alias", "sling:alias",
resolver, queryStringWithSort, 2000);
+ } catch (QuerySyntaxException ex) {
+ log.debug("sort with first() not supported, falling back
to base query", ex);
+ it = queryUnpaged(baseQueryString, resolver);
+ } catch (UnsupportedOperationException ex) {
+ log.debug("query failed as unsupported, retrying without
paging/sorting", ex);
Review Comment:
Well, we catch and fallback. Nothing new here.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]