Skip to content

Commit

Permalink
[ALS-6261] Add rankings to search, fix counts bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Sikina committed Jul 21, 2024
1 parent 2eb7a16 commit 9c76d0f
Show file tree
Hide file tree
Showing 6 changed files with 973 additions and 229 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ public List<Concept> getConcepts(Filter filter, Pageable pageable) {
LEFT JOIN concept_node_meta AS continuous_min ON concept_node.concept_node_id = continuous_min.concept_node_id AND continuous_min.KEY = 'min'
LEFT JOIN concept_node_meta AS continuous_max ON concept_node.concept_node_id = continuous_max.concept_node_id AND continuous_max.KEY = 'max'
LEFT JOIN concept_node_meta AS categorical_values ON concept_node.concept_node_id = categorical_values.concept_node_id AND categorical_values.KEY = 'values'
WHERE concept_node.concept_node_id IN
WHERE concept_node.concept_node_id IN (
""";
QueryParamPair filterQ = filterGen.generateFilterQuery(filter, pageable);
sql = sql + filterQ.query();
sql = sql + filterQ.query() + "\n)";
MapSqlParameterSource params = filterQ.params();

return template.query(sql, params, mapper);
Expand Down
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).reversed()).toList()
))
.toList();
}
}
Loading

0 comments on commit 9c76d0f

Please sign in to comment.