Skip to content
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
7 changes: 6 additions & 1 deletion idc_collections/collex_metadata_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,11 @@ def create_query_set(solr_query, sources, source, all_ui_attrs, image_source, Da
query_set.append(solr_query['queries'][attr])
else:
attStr = solr_query['queries'][attr].replace('"', '\\"')
# certain attributes values include quotes, ie Manufacturer = \"GE Healthcare\" which leads to 'subqueries'
# in filter strings with nested quotes, ie,
# _query_:"{!join to=StudyInstanceUID from=StudyInstanceUID}(+Manufacturer:(""GE Healthcare""))"))
# in this case extra backslashes are needed around the inner quotes
attStr = attStr.replace('\\\\"', '\\\\\\"')
attStr = '(_query_:"{!join to=' + default_join_field + ' from=' + default_join_field + '}' + attStr + '")'
query_set.append(attStr)
# If it's in another source for this program, we need to join on that source
Expand Down Expand Up @@ -2290,7 +2295,7 @@ def get_cart_data_serieslvl(filtergrp_list, partitions, field_list, limit, offse
solr_query = build_solr_query(
copy.deepcopy(filtergrp),
with_tags_for_ex=False,
search_child_records_by=None
search_child_records_by=None, solr_default_op='AND'
)
query_set_for_filt = create_query_set(solr_query, aux_sources, image_source, all_ui_attrs, image_source,
DataSetType, default_join_field='StudyInstanceUID')
Expand Down
5 changes: 5 additions & 0 deletions solr_helpers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,11 @@ def build_solr_query(filters, comb_with='AND', with_tags_for_ex=False, subq_join
"{!join to=%s from=%s}%s" % (search_child_records_by[attr_name], search_child_records_by[attr_name],
query_str.replace("\"", "\\\"")))

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

if with_tags_for_ex:
Expand Down