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
Amadeus House, Floral Street, London  WC2E 9DPUK
@shapeblue
  
 

Reply via email to