Blossom is a Java framework based on Spring-Boot which enables you to realize your projects quickly and smoothly. It comes with several modules and tools made to ease and speed up your development process.
The ElasticSearch search sort is computed in method SearchEngineImpl.prepareSearch :
Sort sort = pageable.getSort();
if (sort != null) {
for (Order order : pageable.getSort()) {
SortBuilder sortBuilder = SortBuilders.fieldSort("dto." + order.getProperty())
.order(SortOrder.valueOf(order.getDirection().name()));
searchRequest.addSort(sortBuilder);
}
searchRequest.addSort(SortBuilders.scoreSort());
}
With this computing, you can only sort by DTO fields.
If the indexing has been adapted to index additional fields external to the DTO, it is not possible to use them for sorting without overriding the whole prepareSearch method.
TODO : Extract the order computing in an overridable method
The ElasticSearch search sort is computed in method
SearchEngineImpl.prepareSearch
:With this computing, you can only sort by DTO fields. If the indexing has been adapted to index additional fields external to the DTO, it is not possible to use them for sorting without overriding the whole prepareSearch method.
TODO : Extract the order computing in an overridable method