From dd4398a54f1589d6d4c01e1c5c79260fbbb46ad7 Mon Sep 17 00:00:00 2001 From: Luke Sikina Date: Sat, 13 Jul 2024 12:06:40 -0400 Subject: [PATCH] 3 --- .../dbmi/avillach/dictionary/concept/ConceptRepository.java | 5 +++-- .../avillach/dictionary/filter/FilterQueryGenerator.java | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/edu/harvard/dbmi/avillach/dictionary/concept/ConceptRepository.java b/src/main/java/edu/harvard/dbmi/avillach/dictionary/concept/ConceptRepository.java index 3743710..ee47341 100644 --- a/src/main/java/edu/harvard/dbmi/avillach/dictionary/concept/ConceptRepository.java +++ b/src/main/java/edu/harvard/dbmi/avillach/dictionary/concept/ConceptRepository.java @@ -49,10 +49,11 @@ public List 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); diff --git a/src/main/java/edu/harvard/dbmi/avillach/dictionary/filter/FilterQueryGenerator.java b/src/main/java/edu/harvard/dbmi/avillach/dictionary/filter/FilterQueryGenerator.java index 4a88b7f..abe03db 100644 --- a/src/main/java/edu/harvard/dbmi/avillach/dictionary/filter/FilterQueryGenerator.java +++ b/src/main/java/edu/harvard/dbmi/avillach/dictionary/filter/FilterQueryGenerator.java @@ -90,6 +90,9 @@ private String createSearchFilter(String search, MapSqlParameterSource params) { ts_rank(searchable_fields, (phraseto_tsquery(:search)::text || ':*')::tsquery) as rank FROM concept_node + 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.searchable_fields @@ (phraseto_tsquery(:search)::text || ':*')::tsquery AND (