Last active
December 18, 2015 16:29
-
-
Save richmolj/5811237 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post | |
def search(keywords) | |
search = Sunspot.search(Post) do | |
fulltext keywords | |
order_by :published_at, :desc if Configuration.post_ordering? | |
end | |
end | |
CustomAlarmHandler.new(:post_search).raise('empty!') if search.results.empty? | |
StatsCollector.register_event(:post_search, keywords) | |
search.results | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment