/** * Makes service calls to get the count and search results for the given query, and packages * those up as an AlreadyPaged search result * * @param query * @param context * @return */ public AlreadyPaged<T> search(String query, RequestContext context) { OpenmrsService service = Context.getService(serviceClass); List<T> results; Integer count; results = doPagedSearch(service, query, context); count = doCount(service, query, context); boolean hasMore = count > context.getStartIndex() + context.getLimit(); return new AlreadyPaged<T>(context, results, hasMore); }