Skip to content

Commit

Permalink
ensure exact match on legacyid using keyword, re #11597
Browse files Browse the repository at this point in the history
  • Loading branch information
whatisgalen committed Nov 26, 2024
1 parent 2a19dfc commit 2e89cf5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions arches/app/datatypes/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2269,10 +2269,9 @@ def transform_value_for_tile(self, value, **kwargs):
converted_value = value

value_type = None
if not isinstance(converted_value, list):
converted_value = [converted_value]
for value_subtype_label, value_subtype_class in list(subtypes_dict.items()):
if not isinstance(converted_value, list):
converted_value = [converted_value]

if isinstance(converted_value[0], value_subtype_class):
value_type = value_subtype_label
break
Expand All @@ -2286,7 +2285,9 @@ def transform_value_for_tile(self, value, **kwargs):
match value_type:
case "str": # aka legacyid
# query the graphid associated with each resourceinstance.legacyid
boolquery.filter(Terms(field="legacyid", terms=converted_value))
boolquery.must(
Terms(field="legacyid.keyword", terms=converted_value)
) # exact match on keyword
query.add_query(boolquery)
results = query.search(index=RESOURCES_INDEX)
for hit in results["hits"]["hits"]:
Expand Down

0 comments on commit 2e89cf5

Please sign in to comment.