From 221cc80140f1d25ddc5dd791fb232915bf0e680c Mon Sep 17 00:00:00 2001 From: Michael Bianco Date: Mon, 15 Jul 2013 12:52:53 -0400 Subject: [PATCH] Fixing issue with param filtering that was breaking search sorting --- app/models/spree/search/spree_sunspot/search.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/models/spree/search/spree_sunspot/search.rb b/app/models/spree/search/spree_sunspot/search.rb index 381e00c..7445a71 100644 --- a/app/models/spree/search/spree_sunspot/search.rb +++ b/app/models/spree/search/spree_sunspot/search.rb @@ -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 @@ -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"]