Skip to content

Commit

Permalink
order
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Sikina committed Jul 18, 2024
1 parent 34bd7a9 commit faa6f63
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ public List<FacetCategory> extractData(ResultSet rs) throws SQLException, DataAc
// group facets by category, then add them to their respective category
Map<String, List<Facet>> grouped = facets.stream().collect(Collectors.groupingBy(Facet::category));
return categories.entrySet().stream()
.map(e -> new FacetCategory(e.getValue(), grouped.getOrDefault(e.getKey(), List.of())))
.map(e -> new FacetCategory(
e.getValue(),
grouped.getOrDefault(e.getKey(), List.of()).stream().sorted(Comparator.comparingInt(Facet::count)).toList()
))
.toList();
}
}

0 comments on commit faa6f63

Please sign in to comment.