Hi team,

I'm migrating an app from JR 1.6.4 to 2.2.7.
My unit tests don't pass anymore, because of the well-known behaviour of QueryResult.getSize() returning -1 in many cases. Moreover, I have a query returning no results (result.getNodes().hasNext() returns false), but the getSize() still returns -1 ! I know there's some workaround ("order by @jcr:score descending"), but it seems quite a hack to me.

Diving into the code, I looked at QueryResultImpl#getResult(long) and was wondering why the numResults (which at the end is the value returned by getSize()) is given the value of result.getSize() (which often returns -1) and not the value of resultNodes.size() (though only relevant when all results have been fetched, which is often the case with a default fetch size of Integer.MAX_VALUE !).

I am not sure to fully understand that piece of code, so don't hesitate to tell me that I'm totally wrong :)

Best regards,

--
Cédric Damioli
CMS Ametys
ANYWARE SERVICES
http://www.anyware-services.com
http://www.ametys.org

Ce message et toutes les pièces jointes (le "Message") sont confidentiels et 
établis à l'intention exclusive de ses destinataires.
Toute modification, édition, utilisation ou diffusion non autorisée est 
interdite.
Anyware Services décline toute responsabilité au titre de ce Message s'il a été 
altéré, déformé, falsifié ou édité, diffusé sans autorisation.


Reply via email to