Paging only works beyond 1000 items when filtering on a property value

cancel
Showing results for 
Search instead for 
Did you mean: 
marktielemans
Active Member II

Paging only works beyond 1000 items when filtering on a property value

Jump to solution

I am running Alfresco 201605 community.

Considering the following Javascript:

function findJs(skipCount, pageSize) {
    var q = {
        query: 'TYPE:"my:customType"',
        language: 'fts-alfresco',
        store: 'workspace://SpacesStore',
        page: {
            maxItems: pageSize,
            skipCount: skipCount
        }
    };

    return search.query(q);
}

logger.log(findJs(0, 100).length);
logger.log(findJs(1000, 100).length);‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I know I have 11.025 nodes in Alfresco that are searchable and should be included in the result for this query. However, this prints:

100
0‍‍

When I change the query to include a property filter that matches all 11.025 nodes, as follows:

function findJs(skipCount, pageSize) {
    var q = {
        query: 'TYPE:"my:customType" AND (my:prop:"Textvalue")',
        language: 'fts-alfresco',
        store: 'workspace://SpacesStore',
        page: {
            maxItems: pageSize,
            skipCount: skipCount
        }
    };

    return search.query(q);
}

logger.log(findJs(0, 100).length);
logger.log(findJs(1000, 100).length);‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

This prints

100
100‍‍

Interestingly, executing this in Java, the following:

ResultSet rs = searchService.query(searchParameters);
logger.debug(rs.hasMore());
logger.debug(rs.length());‍‍‍

Will log

true
0‍‍

when not filtering on a prop value, and 

true
100‍‍

as expected when filtering on a prop value.

What might cause this difference in behavior when I query with and without a property value filter?

1 Solution

Accepted Solutions
marktielemans
Active Member II

Re: Paging only works beyond 1000 items when filtering on a property value

Jump to solution

It turns out this is ACL checks related. The hard limit of 1000 nodes was the clue here.

When I run the query with skip 1000 and sp.setMaxPermissionChecks(1001); I get 1 result. When I run it with sp.setMaxPermissionChecks(Integer.MAX_VALUE); I get all my results (up until 2147483647 I suppose). I guess this is because paging is done on the resultset after ACL checks are.

It seems with this solution we'll be good for at least until we have well over 2 billion nodes Smiley Happy.

View solution in original post

1 Reply
marktielemans
Active Member II

Re: Paging only works beyond 1000 items when filtering on a property value

Jump to solution

It turns out this is ACL checks related. The hard limit of 1000 nodes was the clue here.

When I run the query with skip 1000 and sp.setMaxPermissionChecks(1001); I get 1 result. When I run it with sp.setMaxPermissionChecks(Integer.MAX_VALUE); I get all my results (up until 2147483647 I suppose). I guess this is because paging is done on the resultset after ACL checks are.

It seems with this solution we'll be good for at least until we have well over 2 billion nodes Smiley Happy.