cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anurag Awasthi <Anurag.Awas...@shapeblue.com>
Subject Question about GenericDaoBase#searchAndCount method
Date Mon, 01 Jul 2019 04:13:35 GMT
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.Awasthi@shapeblue.comĀ 
www.shapeblue.com
Amadeus House, Floral Street, London  WC2E 9DPUK
@shapeblue
  
 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message