In some cases where the response is being paginated, the count would represent the total number of resources while the size of the returned array/list of resources would be less.
Regards, Rohit Yadav Software Architect, ShapeBlue https://www.shapeblue.com ________________________________ From: Anurag Awasthi <anurag.awas...@shapeblue.com> Sent: Monday, July 1, 2019 9:43:35 AM To: dev@cloudstack.apache.org Subject: Question about GenericDaoBase#searchAndCount method Hi Devs, I was looking at a bug and observed that In GenericDaoBase.java#searchAndCount we have the following function - public Pair<List<T>, Integer> searchAndCount(final SearchCriteria<T> sc, final Filter filter) { List<T> objects = search(sc, filter, null, false); Integer count = getCount(sc); // Count cannot be less than the result set but can be higher due to pagination, see CLOUDSTACK-10320 if (count < objects.size()) { count = objects.size(); } return new Pair<List<T>, Integer>(objects, count); } Internally the getCount above ignores the Group By parts of Search Query to retrieve count. It could result in the List and Count being returned as different. Perhaps some documentation is missing here. Does anyone know why we have this logic? Regards, Anurag anurag.awas...@shapeblue.com www.shapeblue.com<http://www.shapeblue.com> Amadeus House, Floral Street, London WC2E 9DPUK @shapeblue rohit.ya...@shapeblue.comĀ www.shapeblue.com Amadeus House, Floral Street, London WC2E 9DPUK @shapeblue