1

I wrote below Query in CMIS.

Query= select * from cmis:document

But it returns only first 100 results. Actually in Repository more than 100 results are there.

So how can i get All results using same query?

I wrote below CMIS Code--

Code=

  public ArrayList<JSONObject> search() {
    ItemIterable<QueryResult> results =null;    
    StringBuilder sb=null;
    sb = new StringBuilder();

    sb.append("select * from hr:hrdoctype");
    CMISSession1 s=new CMISSession1();        
    Session session=s.getSession();

    // execute query
    results = session.query(sb.toString(), false);

    ArrayList<JSONObject> list=new ArrayList<>(); 

    for (QueryResult qr : results) {

        GregorianCalendar gc = (GregorianCalendar) qr.getPropertyValueById("cmis:creationDate");        


        try{

         int month = gc.getTime().getMonth();  
         -
         -
         -


       }
       catch(org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException e)
       {

       }


       }

        -------------      
         list.add(json);
    }

    return list;

}

Please Help.

Thanks in Advance.

Deepak Talape
  • 997
  • 1
  • 9
  • 35

1 Answers1

5

From an OpenCMIS point of view that looks alright. However, for performance reasons you should change the batch size:

OperationContext oc = session.createOperationContext();
oc.setMaxItemsPerPage(10000); // batch size, default = 100
results = session.query(sb.toString(), false, oc);

Please see also this thread: https://community.alfresco.com/thread/206836-alfresco-cmis-query-returning-only-100-results

Florian Müller
  • 3,215
  • 1
  • 14
  • 11