I found this function quite hard to understand as well. It might be better to inline them into the transformSearchResults as that better defines its purpose. Otherwise, some additional documentation could help as well.