Skip to content

Instantly share code, notes, and snippets.

@vanstee
Created July 26, 2011 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanstee/1107876 to your computer and use it in GitHub Desktop.
Save vanstee/1107876 to your computer and use it in GitHub Desktop.
if top_score = top_hits.map(&:score).max
- top_hits.detect { |h| h.score == top_score }.result
+ sid = top_hits.detect { |h| h.score == top_score }.stored(:demandbase_sid)
+ Company.find_by_demandbase_sid(sid)
elsif not options.keys.include?(:country)
# There's no location information or no matches based on location
# revert to a search with no scope
- solr_hits(q, options, nil).first.try(:result)
+ sid = solr_hits(q, options, nil).first.stored(:demandbase_sid)
+ Company.find_by_demandbase_sid(sid)
else
nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment