Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-15540

CMIS query not returning expected amount of results


    • Type: Service Pack Request
    • Status: Closed
    • Resolution: Won't Fix
    • Affects Version/s:,
    • Fix Version/s: None
    • Labels:
    • Bug Priority:
      Category 2
    • ACT Numbers:



      Problem description

      When there are 1001+ folders in Alfresco, the following CMIS query is not returning the expected amount of results:

      String queryString = "SELECT cmis:name FROM cmis:folder";
      OperationContext oc = new OperationContextImpl();
      ItemIterable<QueryResult> results = session.query(queryString, false, oc);
      int pageNumber = 33;
      // this will return 10, which it a partial page from 990 to 1000
      long countInPage = results.skipTo(pageNumber * oc.getMaxItemsPerPage()).getPage().getPageNumItems();
      System.out.println("Number of results in page " + pageNumber + ": " + countInPage);

      Alfresco runs the query without concern for the pagination and then wraps it into a PagingLuceneResultSet. This is fine as long as you want results that are in the first one thousand. Because of system.acl.maxPermissionChecks, if you request a page that is after the first thousand entries you will get no results. The workaround is to increase system.acl.maxPermissionChecks to 2000 but this would have to be likely further increased in this case if there are more folders in the system. Paginated queries should either go against SOLR or it should be ensured that the database can handle the pagination.

      Therefore we have a situation where although you set CMIS to use the database only, it is still restricted by system.acl.maxPermissionChecks


      Alfresco and
      Maven dependencies:

      Steps to Replicate:
      1. In an OOTB Alfresco or install, create 1001+ folders.
      2. Ensure that search service is set to 'Always Use Database' for CMIS queries
      3. Run the CMIS test class PaginationFailure.java (see class attached) – also find the compiled jar (java -jar testCMIS00582101-0.0.1-SNAPSHOT-jar-with-dependencies.jar)
      Actual behaviour

      When running:
      System.out.println("Number of results in page " + pageNumber + ": " + countInPage);

      The output reads:
      Number of results in page 33: 10

      Expected behaviour

      The output should read (without needing to increase system.acl.maxPermissionChecks beyond 1000):

      Number of results in page 33: 30

      Is this still expected behaviour as per MNT-8515 (and others) even though we've configured to always use the db?


          Issue Links




                • Assignee:
                  closedissues Closed Issues
                  hseritt Harlin Seritt
                • Votes:
                  0 Vote for this issue
                  3 Start watching this issue


                  • Created:

                    Structure Helper Panel