use of com.b2international.index.query.SortBy.Order in project snow-owl by b2ihealthcare.
the class SearchResourceRequest method toQuerySortBy.
/**
* Search requests may alter the default sortBy construction. By default it creates field and script sorts, but special sorts can be constructed using special sort keys.
* @param context - the context to access if needed
* @param sortBuilder - the builder to append to the query sort
* @param sort - the sort to convert to low-level query sort
*/
@OverridingMethodsMustInvokeSuper
protected void toQuerySortBy(C context, Builder sortBuilder, Sort sort) {
final Order order = sort.isAscending() ? Order.ASC : Order.DESC;
if (sort instanceof SortField) {
SortField sortField = (SortField) sort;
sortBuilder.sortByField(sortField.getField(), order);
} else if (sort instanceof SortScript) {
SortScript sortScript = (SortScript) sort;
sortBuilder.sortByScript(sortScript.getScript(), sortScript.getArguments(), order);
} else {
throw new UnsupportedOperationException("Cannot handle sort type " + sort);
}
}
Aggregations