Skip to content

Commit

Permalink
Minor cleanup + spelling fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveitaly committed May 8, 2012
1 parent 8256c66 commit c1075bb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions app/views/spree/products/_sort_bar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ unless params.keys.detect { |k| k != 'controller' and k != 'action' }.nil?
options = Spree::Search::SpreeSunspot.configuration.sort_fields.map do |key, value|
# value is sort direction
value = [value] if !value.is_a? Array
Rails.logger.info "Array Key sort.#{key}_#{value}"
value.map { |sort| [t("sort.#{key}_#{sort}"), url_for(request.params.merge({:sort => key, :order => sort}))] }
end

Expand Down
4 changes: 2 additions & 2 deletions lib/generators/templates/spree_sunspot_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# conf.option_facets = []
# conf.property_facets = []
# conf.other_facets = []
# conf.show_facet = []
# conf.show_facets = []
# conf.fields = []
# conf.sort_field = []
# conf.sort_fields = {}
# end
1 change: 1 addition & 0 deletions lib/spree/search/spree_sunspot/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ def self.configure
end
end

# TODO move this to a more appropiate / intention revealing location
Spree::Search::SpreeSunspot.configure {}
11 changes: 4 additions & 7 deletions lib/spree/search/spree_sunspot/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ module SpreeSunspot

class Search < defined?(Spree::Search::MultiDomain) ? Spree::Search::MultiDomain : Spree::Core::Search::Base
def retrieve_products
@properties[:sunspot] = Sunspot.search(::Spree::Product) do
conf = Spree::Search::SpreeSunspot.configuration
conf = Spree::Search::SpreeSunspot.configuration

@properties[:sunspot] = Sunspot.search(::Spree::Product) do
# This is a little tricky to understand
# - we are sending the block value as a method
# - Spree::Search::Base is using method_missing() to return the param values
Expand All @@ -26,9 +26,6 @@ def retrieve_products
# TODO add greater than range
end

# TODO should check
# with(sort) unless ['price', 'score'].include? sort

order_by sort.to_sym, order.to_sym
with(:is_active, true)
keywords(query)
Expand All @@ -51,14 +48,14 @@ def prepare(params)
# when taxon navigation is in place, Spree::TaxonsController passes :taxon in params
@properties[:taxon_name_facet] = params[:taxon] unless params[:taxon].blank?

conf.display_facets.each do |name|
Spree::Search::SpreeSunspot.configuration.display_facets.each do |name|
@properties[name] = params["#{name}_facet"]
end

end

end

end
end
end

0 comments on commit c1075bb

Please sign in to comment.