Details
Description
Currently, the same resource might be returned more than once from a search query, it the criteria match more than once. Ideally, each resource would be returned only once.
This can (hopefully) be accomplished by using the UUID of the base object to group results, probably by changing createCriteria in BaseFhirDao to something like this:
protected Criteria createCriteria(SearchParameterMap theParams) { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(typeToken.getRawType()); setupSearchParams(criteria, theParams); handleSort(criteria, theParams.getSortSpec()); criteria.setProjection(Projections.groupProperty("uuid")); return criteria; }
We should add tests to ensure that ordering is in some sense consistent across pages when doing this and to ensure that all existing tests either pass or fail because of an expected breakage. We should also add tests to ensure that only unique results are returned for each resource.