Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ranked search #13

Merged
merged 1 commit into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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