Thanks Jorge. Tested it. Works like a charm :-)
On Tue, Aug 19, 2014 at 10:14 AM, <jorge.martin-cue...@ext.ec.europa.eu> wrote: > Hello Joshy, > > > > If you call getPage() the default is 100, buf if you don't call this > method you will get all results. > > If you pass a parameter, this will be the limit of elements per page (in > CMIS maxItems) > > > > ItemIterable<QueryResult> items = session.query("select * from > cmis:document", false); > > > > //items = items.getPage(30); //set page size to 30 > > //items = items.getPage(); //default to 100 > > //items = items.skipTo(1); //skip items (in CMIS skipCount) > > > > System.out.println("items.getPageNumItems() " + items.getPageNumItems()); > > System.out.println("items.getTotalNumItems() " + items.getTotalNumItems()); > > > > Iterator<QueryResult> iterator = items.iterator(); > > int i=0; > > while(iterator.hasNext()) { > > i++; > > QueryResult result = iterator.next(); > > System.out.println(result.getPropertyById("cmis:name")); > > } > > System.out.println(i); > > > > Regards. > > *Jorge MARTIN CUERVO* > > [image: cid:image001.gif@01CCF6D0.4613B970] > *European Commission* > DG TRADE > Unit A4 > > CHAR 02/077 > B-1049 Brussels/Belgium > +32 2 298 86 27 > jorge.martin-cue...@ext.ec.europa.eu > > > > -----Original Message----- > From: Joshy Augustine [mailto:joshymaugust...@gmail.com] > Sent: Tuesday, August 19, 2014 10:53 AM > To: Florian Müller > Cc: dev@chemistry.apache.org > Subject: Re: Apache Chemistry 0.11 + alfresco 4.2 pagination question > > > > Hi, > > > > Can I ask you a related question? > > > > Am I right to understand that by default Open CMIS Client will set > > maxResults for a query as 100? I also understand that it is possible to > > over-ride this flag with a higher value in OperationContext supplied to > > session.query() method. I presume both the above mechanisms are set in > > place in order to encourage the user to use an 'iterative approach' to deal > > with large resultsets rather than fetching all the results(which will have > > an associated performance penatlty) from the ECM Repository. > > > > However, I am interested to know if there is a need, whether it is possible > > to obtain *all* results that matches a query via open CMIS API? > > > > For example, is the following possible? > > > > ItemIterable<QueryResult> allResultsInECMThatMatchesTheQuery = > > session.query(complete_statement,false,context); > > > > Thanks, > > Joshy > > > > On Wed, Aug 13, 2014 at 7:12 PM, Florian Müller <f...@apache.org> wrote: > > > > > Hi Joshy, > > > > > > That is likely a repository bug. The hasMoreItems flag should be true in > > > this case. > > > > > > > > > - Florian > > > > > > > > > > Hi, > > > > > > > > Apologies in advance if I am missing something obvious. I am > encountering > > > > the following situation in my test code. > > > > > > > > > > > > ItemIterable<QueryResult> queryResult = > session.query(complete_statement, > > > > *false*,context); > > > > > > > > > > > > > > > > > > > > queryResult.getTotalNumItems() // returns 3 > > > > > > > > queryResult.skipTo(0).getPage(2).getHasMoreItems() //returns *false* > > > > > > > > > > > > > > > > Is it correct that the 3 rd line is returning false? > > > > > > > > > > > > > > > > > > > -- > > Cheers, > > Josh > -- Cheers, Josh