Created
August 21, 2009 16:12
-
-
Save bsy/172147 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def nationwide_search | |
category_ids = self.category_ids | |
Business.search do |search| | |
search.any_of do | |
with :category_ids, category_ids unless category_ids.blank? | |
with :category_ids, nil | |
end | |
search.keywords query | |
search.order_by :name if order == :alpha | |
search.order_by :review_count, :desc if order == :review_count | |
search.order_by :stars, :desc if order == :rating | |
search.paginate :page => page, :per_page => per_page | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment