fix 'distinct: true' bug

-using .uniq caused Active Record errors on search results sorted by associated model's attribute
-changed .uniq to using hash keys to ensure distinctness of results