chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian Müller <f...@apache.org>
Subject Re: Question about Paging - numItems
Date Sat, 20 Aug 2016 11:38:37 GMT
That's right.
I'll extend the JavaDoc and add a code sample on the website.

- Florian


Am 20. August 2016 04:17:44 schrieb Sascha Homeier <shomeier@apollon.de>:

> Hi Florian,
>
> items now show up properly.
> Thx Florian.
>
> I think I might give some advice to our customers on how to get the pages 
> properly.
> So regarding to your fix the code on client side should look like this:
>
> // initial query with properly set maxItems in operationContext
> results = query(statement, searchAllversions, opCtx);
>
> ItemIterable<QueryResult> page = results;
>
> // skip items if necessary ( > 0)
> if (skipCount > 0) {
> page = page.skipTo(skipCount);
> }
>
> // get the page of ‘maxHits' items
> page = page.getPage(maxHits);
>
> // iterate through all items on the page
> for (QueryResult qr : page) {
> ...
> }
>
> Right?
>
> tia
>
> Cheers
> Sascha
>
> P. +84 166 456-3331
> shomeier@apollon.de
>
> turning technology.
>
> apollon GmbH+Co. KG
> Maximilianstr. 104
> 75172 Pforzheim / Germany
> www.apollon.de
>
> Geschäftsführer: Eugen Müller (Vors.), Ingrid Müller (stv. Vors.),
> Peter Schellhorn, Norbert Weckerle
> Amtsgericht Mannheim HRA 500441
> PhG: Meyle+Müller Verwaltungs-GmbH HRB 500138
>
> apollon auf der dmexco Köln 14./15. September 2016
> Halle 6.1 / Stand A-064
> Schnell Tickets sichern!
> On Aug 19, 2016, at 10:27 PM, Florian Müller 
> <fmui@apache.org<mailto:fmui@apache.org>> wrote:
>
> Hi Sascha,
>
> You found a bug in the Workbench!
> It's now fixed.
>
> Thanks for reporting it!
>
>
> - Florian
>
>
> Hi Florian,
> thx for the info.
> Yes, on server side I only return 5 hits except for the last page
> where I only return 1 (total numItems = 16).
> I am just a bit confused about the display in the Chemistry Workbench
> QueryFrame:
> When I set skipCount to 0 with maxHits = 5 it properly only shows up 5
> hits.
> But when I set skipCount to 5 it fetches all the pages up to the end
> and shows 11 hits
> In the code of the QueryFrame the ItemIterable (variable “page")
> then automatically fetches the next page when getting to the end of
> one page.
> results = model.query(text, searchAllVersionsCheckBox.isSelected(),
> maxHits);
> ...
> ItemIterable<QueryResult> page = results.getPage(maxHits);
> for (QueryResult qr : page)
> {
> // with skipCount > 0 here at every 5th loop the next page is
> automatically fetched from server
> ...
> }
> ...
> When I set numItems like Alfresco Demo Server does then it is
> displayed properly (Alfresco seems to set numItems to 5 for first
> page, 10 for second page and so on …).
> But this setting of numItems is wrong when I understood you correctly.
> So I am just wondering if I do sth. wrong or this is an issue
> elsewhere?
> tia
> Cheers
> Sascha
> P.
> +84 166 456-3331 [1]
> SHOMEIER@APOLLON.DE<mailto:SHOMEIER@apollon.de>
> turning technology.
> apollon GmbH+Co. KG
> MAXIMILIANSTR. 104 [2]
> 75172 PFORZHEIM / GERMANY [2]
> WWW.APOLLON.DE [3]
> Geschäftsführer: Eugen Müller (Vors.), Ingrid Müller (stv. Vors.),
> Peter Schellhorn, Norbert Weckerle
> Amtsgericht Mannheim HRA 500441
> PhG: Meyle+Müller Verwaltungs-GmbH HRB 500138
> apollon auf der dmexco Köln 14./15. September 2016
> Halle 6.1 / Stand A-064
> SCHNELL TICKETS SICHERN! [4]
> On Aug 19, 2016, at 5:32 PM, Florian Müller <fmui@apache.org>
> wrote:
> Hi Sascha,
> You are right, totalNumItems should stay the same for each page
> (assuming that the data in the repository doesn't change).
> Some repositories don't always return a value for totalNumItems, but
> that's OK from the spec point of view.
> If the client sets maxItems to 5 the server MUST NOT return more
> than 5 hits. It may return fewer hits (because there are no more
> hits or because of any server constraints), but never more.
> OpenCMIS doesn't have a TCK test for that, yet. It may be worth
> adding one...
> - Florian
> Hi all,
> I am currently struggling with the paging of a query result set.
> Did I understand it correctly that “numItems” should contain
> the whole
> number of items (if the repository knows about it)?
> So for example a repository only contains 16 documents all from
> type
> cmis:document and we have a query like:
> “SELECT cmis:name FROM cmis:document ORDER BY cmis:name”
> When we set the page size (maxItems) to 5 and the skipCount to 0
> then
> I assume that the server should pass the first 5 results (the
> first
> page) and set the numItems to 16.
> When we want the second page we set skipCount to 5 (and leave
> maxItems
> = 5) and still numItems is 16.
> Third page with a skipCount of 10 and still numItems = 16. And so
> on…
> Is this correct?
> Cause when I do it this way on the server the QueryFrame in the
> CMIS
> Workbench gives me 11 hits for skipCount = 5 and maxItems = 5 (the
> ItemIterable in the loop just goes through all pages).
> I compared with Alfresco CMIS Demo server. For this the Workbench
> QueryFrame properly only shows up 5 hits for every page but it
> seems
> the Alfresco Server does set “numItems” to the summed up
> number of
> items until current page (numItems = 5 for skipCount = 0, numItems
> =
> 10 for skipCount = 5).
> I strongly assume Alfresco is right here.
> tia
> Cheers
> Sascha
> P. +84 166 456-3331
> shomeier@apollon.de
> turning technology.
> apollon GmbH+Co. KG
> Maximilianstr. 104
> 75172 Pforzheim / Germany
> www.apollon.de
> Geschäftsführer: Eugen Müller (Vors.), Ingrid Müller (stv.
> Vors.),
> Peter Schellhorn, Norbert Weckerle
> Amtsgericht Mannheim HRA 500441
> PhG: Meyle+Müller Verwaltungs-GmbH HRB 500138
> apollon auf der dmexco Köln 14./15. September 2016
> Halle 6.1 / Stand A-064
> Schnell kostenlose Tickets downloaden – nur vom 18.7. bis
> 15.8.2016
> Links:
> ------
> [1] tel:+84%20166%20456-3331
> [2]
> https://www.google.co.uk/maps/place/Maximilianstra%C3%9Fe+104,+75172+Pforzheim,+Germany/@48.89268,8.67968,17z/data=!3m1!4b1!4m2!3m1!1s0x4797726b6a5de607:0xbb6167336f3c7a96
> [3] http://www.apollon.de
> [4] http://dmexco.de/tickets/
>



Mime
View raw message