Skip to content

Commit

Permalink
Fixing issue with param filtering that was breaking search sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveitaly committed Jul 15, 2013
1 parent e2ce222 commit 221cc80
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/models/spree/search/spree_sunspot/search.rb
Expand Up @@ -43,8 +43,7 @@ def retrieve_products
protected

def prepare(params)
# super copies over :taxon and other variables into properties
# as well as handles pagination
# super copies over :taxon and other variables into properties as well as handles pagination
super

conf = Spree::Search::SpreeSunspot.configuration
Expand All @@ -60,8 +59,8 @@ def prepare(params)
@properties[:order] = params[:order] || conf.default_sort_order

# ensure that :sort and :order are legit
@properties[:sort] = :score unless conf.sort_fields.keys.include? @properties[:sort]
@properties[:order] = :desc unless [:desc, :asc].include? @properties[:order]
@properties[:sort] = :score unless conf.sort_fields.keys.include? @properties[:sort].to_sym
@properties[:order] = :desc unless [:desc, :asc].include? @properties[:order].to_sym

conf.display_facets.each do |name|
@properties[name] ||= params["#{name}_facet"]
Expand Down

0 comments on commit 221cc80

Please sign in to comment.