From faa6f63a497d7b5c354c86c79dc43ea5472f14e2 Mon Sep 17 00:00:00 2001 From: Luke Sikina Date: Thu, 18 Jul 2024 12:38:25 -0400 Subject: [PATCH] order --- .../avillach/dictionary/facet/FacetCategoryExtractor.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/edu/harvard/dbmi/avillach/dictionary/facet/FacetCategoryExtractor.java b/src/main/java/edu/harvard/dbmi/avillach/dictionary/facet/FacetCategoryExtractor.java index 7f93d89..677ab2a 100644 --- a/src/main/java/edu/harvard/dbmi/avillach/dictionary/facet/FacetCategoryExtractor.java +++ b/src/main/java/edu/harvard/dbmi/avillach/dictionary/facet/FacetCategoryExtractor.java @@ -33,7 +33,10 @@ public List extractData(ResultSet rs) throws SQLException, DataAc // group facets by category, then add them to their respective category Map> 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(); } }