criteria.setProjection(Projections.rowCount());
int itemCount = (Integer) criteria.list().get(0);
// even when no item has this field value currently, items may have history with this field value
// because of the "parent" difference, cannot use AbstractItem and have to do a separate Criteria query
criteria = getSession().createCriteria(History.class);
criteria.createCriteria("parent").add(Restrictions.eq("space", space));
criteria.add(Restrictions.eq(field.getName().toString(), optionKey));
criteria.setProjection(Projections.rowCount());
return itemCount + (Integer) criteria.list().get(0);
}