Skip to content

Commit

Permalink
Fix return results for multi data source and check value before check
Browse files Browse the repository at this point in the history
  • Loading branch information
khaledk2 committed Nov 18, 2024
1 parent 37fceb9 commit a9d6780
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
21 changes: 11 additions & 10 deletions omero_search_engine/api/v1/resources/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1263,16 +1263,17 @@ def get_studies_titles(idr_name, resource, data_source=None):
resourse_res = search_index_using_search_after(
res_index, resource_query, None, None, None
)
for item_ in resourse_res["results"]:
study_title["id"] = item_.get("id")
study_title["name"] = item_.get("name")
study_title["type"] = resource
# study_title["description"] = item_.get("description")
for value in item_.get("key_values"):
if value.get("name"):
value["key"] = value["name"]
del value["name"]
study_title["key_values"] = item_.get("key_values")
if len(resourse_res)>0:
for item_ in resourse_res["results"]:
study_title["id"] = item_.get("id")
study_title["name"] = item_.get("name")
study_title["type"] = resource
# study_title["description"] = item_.get("description")
for value in item_.get("key_values"):
if value.get("name"):
value["key"] = value["name"]
del value["name"]
study_title["key_values"] = item_.get("key_values")
return study_title


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,12 @@ def prepare_data(data, data_source, doc_type):
row_to_insert["key_values"] = []
data_to_be_inserted[row["id"]] = row_to_insert
key_value = row_to_insert["key_values"]
key_value.append(
{
"name": row.get("mapvalue_name"),
"value": row.get("mapvalue_value"),
"index": row.get("mapvalue_index"),
if row.get("mapvalue_name"):
key_value.append(
{
"name": row.get("mapvalue_name"),
"value": row.get("mapvalue_value"),
"index": row.get("mapvalue_index"),
}
)

Expand Down

0 comments on commit a9d6780

Please sign in to comment.