I understand that I could use find_id_by_contents directly to obtain resulting ids with respective scores however I would then have to repeat some of the processing in find_by_contents to load the actual records from the database. I would prefer instead if the find_by_contents method would store the scores it receives from find_id_by_contents and return them with the SearchResults?.
I have attached a patch that does this. Basic example usage would look like this:
In controller:
@query_results = Business.find_by_contents params[:query]
In view:
<% for business in @query_results %>
<tr><td>Name:</td><td><%=h business.name %></td></tr>
<tr><td>Relevance:</td><td><%= @query_results.scores[business.id] %></td></tr>
<% end %>