Skip to content

Commit

Permalink
3
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Sikina committed Jul 13, 2024
1 parent dd4398a commit d0bbf62
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,21 @@ public QueryParamPair generateFilterQuery(Filter filter, Pageable pageable) {


String query = "(\n" + String.join("\n\tINTERSECT\n", clauses) + "\n)";
String havingClause = "";
if (StringUtils.hasText(filter.search())) {
String searchQuery = createSearchFilter(filter.search(), params);
query = "(" + query + "\n\tUNION \n\t" + searchQuery + ")";
havingClause = "HAVING max(rank) > 0\n";
}
String superQuery = """
WITH q AS (
%s
)
SELECT concept_node_id
FROM q
GROUP BY concept_node_id
HAVING max(rank) > 0
GROUP BY concept_node_id %s
ORDER BY max(rank) DESC
""".formatted(query);
""".formatted(query, havingClause);
if (pageable.isPaged()) {
superQuery = superQuery + """
LIMIT :limit
Expand Down

0 comments on commit d0bbf62

Please sign in to comment.