diff --git a/app/services/search_item_res.rb b/app/services/search_item_res.rb index 8921b8a..a82a199 100644 --- a/app/services/search_item_res.rb +++ b/app/services/search_item_res.rb @@ -53,10 +53,9 @@ def find_source_from_top_hits(top_hits, field, key) match_index = hit .map { |s| remove_nonword_chars(s) } .index(remove_nonword_chars(key)) - matches = hit.map { |s| remove_nonword_chars(s) } # if nothing matches the original key, return the entire source hit # should return a string, regardless - return match_index ? matches[match_index] : matches.join(" ") + return match_index ? hit[match_index] : hit.join(" ") else # it must be single-valued and therefore we are good to go return hit