use of com.b2international.snowowl.core.ResourceTypeConverter.Registry in project snow-owl by b2ihealthcare.
the class ResourceSearchRequest method toQuerySortBy.
@Override
protected void toQuerySortBy(RepositoryContext context, Builder sortBuilder, Sort sort) {
if (sort instanceof SortField) {
SortField sortField = (SortField) sort;
if (ResourceSearchRequestBuilder.TYPE_RANK.equals(sortField.getField())) {
Registry registry = context.service(ResourceTypeConverter.Registry.class);
Map<String, Integer> orderMap = registry.getResourceTypeConverters().values().stream().collect(Collectors.toMap(typeDef -> typeDef.getResourceType(), typeDef -> typeDef.getRank()));
sortBuilder.sortByScriptNumeric(ResourceSearchRequestBuilder.TYPE_RANK, Map.of("ranks", orderMap), sort.isAscending() ? Order.ASC : Order.DESC);
return;
}
}
super.toQuerySortBy(context, sortBuilder, sort);
}
Aggregations