This is why I love ruby. With one simple line I can combine two arrays and filter out duplicates. Here I have used Searchlogic which provides a simple ruby syntax for creating SQL queries. This will execute two SQL queries to the database and combine both resultset but the first query will be presented before the latter. My goal was to search for one parameter in a range of fields, but I wanted to prioritize those results where the paramater exists in more important columns such as name and title. If the parameter is found in columns like description it will be presented at the end of the combined resultset.
return (self.firstname_or_lastname_or_area_or_title_like(search) + self.bio_or_description_like(search) ).uniq