Skip to content

Commit 55742f0

Browse files
authored
Merge pull request #416 from ImagingDataCommons/sprint-gw-72
Sprint gw 72
2 parents 701f715 + 4fe3a61 commit 55742f0

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

idc_collections/collex_metadata_utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,11 @@ def create_query_set(solr_query, sources, source, all_ui_attrs, image_source, Da
11001100
query_set.append(solr_query['queries'][attr])
11011101
else:
11021102
attStr = solr_query['queries'][attr].replace('"', '\\"')
1103+
# certain attributes values include quotes, ie Manufacturer = \"GE Healthcare\" which leads to 'subqueries'
1104+
# in filter strings with nested quotes, ie,
1105+
# _query_:"{!join to=StudyInstanceUID from=StudyInstanceUID}(+Manufacturer:(""GE Healthcare""))"))
1106+
# in this case extra backslashes are needed around the inner quotes
1107+
attStr = attStr.replace('\\\\"', '\\\\\\"')
11031108
attStr = '(_query_:"{!join to=' + default_join_field + ' from=' + default_join_field + '}' + attStr + '")'
11041109
query_set.append(attStr)
11051110
# If it's in another source for this program, we need to join on that source
@@ -2290,7 +2295,7 @@ def get_cart_data_serieslvl(filtergrp_list, partitions, field_list, limit, offse
22902295
solr_query = build_solr_query(
22912296
copy.deepcopy(filtergrp),
22922297
with_tags_for_ex=False,
2293-
search_child_records_by=None
2298+
search_child_records_by=None, solr_default_op='AND'
22942299
)
22952300
query_set_for_filt = create_query_set(solr_query, aux_sources, image_source, all_ui_attrs, image_source,
22962301
DataSetType, default_join_field='StudyInstanceUID')

solr_helpers/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,11 @@ def build_solr_query(filters, comb_with='AND', with_tags_for_ex=False, subq_join
573573
"{!join to=%s from=%s}%s" % (search_child_records_by[attr_name], search_child_records_by[attr_name],
574574
query_str.replace("\"", "\\\"")))
575575

576+
# certain attributes values include quotes, ie Manufacturer = \"GE Healthcare\" which leads to 'subqueries'
577+
# in filter strings with nested quotes, ie,
578+
# _query_:"{!join to=StudyInstanceUID from=StudyInstanceUID}(+Manufacturer:(""GE Healthcare""))"))
579+
# in this case extra backslashes are needed around the inner quotes
580+
query_str = query_str.replace('\\\\"','\\\\\\"')
576581
full_query_str += query_str
577582

578583
if with_tags_for_ex:

0 commit comments

Comments
 (0)