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

    Details

    • Bug Priority:
      Category 2
    • ACT Numbers:

      00582101

      Description

      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();
      oc.setMaxItemsPerPage(30);
      
      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

      Environment:

      Alfresco 5.0.2.1 and 5.0.2.5
      Maven dependencies:

      <dependency> 
      	<groupId>org.apache.chemistry.opencmis</groupId> 
      	<artifactId>chemistry-opencmis-client-impl</artifactId> 
      	<version>0.8.0</version> 
      </dependency>
      <dependency>
      	<groupId>org.alfresco.cmis.client</groupId>
      	<artifactId>alfresco-opencmis-extension</artifactId>
      	<version>0.3</version>
      </dependency>
      Steps to Replicate:
      1. In an OOTB Alfresco 5.0.2.1 or 5.0.2.5 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?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                closedissues Closed Issues
                Reporter:
                hseritt Harlin Seritt [X] (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: