cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anurag Awasthi <>
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 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
        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?


Amadeus House, Floral Street, London  WC2E 9DPUK

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