Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Documentation production server config

  • Loading branch information...
commit 9beb9802b0f26e721652477b20bf9ff369cfe263 1 parent 21db50f
@iloveitaly authored
Showing with 35 additions and 11 deletions.
  1. +35 −10 README.md
  2. +0 −1  app/views/spree/products/_sort_bar.html.erb
View
45 README.md
@@ -1,13 +1,13 @@
SpreeSunspotSearch
==================
-Adds Solr search to Spree using [Sunspot](https://github.com/sunspot/sunspot).
+Adds Solr search to Spree Commerce using [Sunspot](https://github.com/sunspot/sunspot).
This is compatible with Spree 1.1.x. Untested on 1.0, but will probably work without too much modification.
-Install
-=======
+Installation
+============
Add spree_sunspot_search to your Gemfile and run bundler.
@@ -28,23 +28,47 @@ Copy the initializer and add `solr_sort_by` to `all.js`:
`rails g spree_sunspot_search:install`
-Running
-=======
+Running & Indexing
+==================
Start up Solr (bundled with Sunspot's install)
-`rake sunspot:solr:run`
+`bundle exec rake sunspot:solr:run`
Build the index for the first time
-`rake sunspot:reindex`
+`bundle exec rake sunspot:reindex`
Stop the solr process:
-`rake sunspot:solr:stop`
+`bundle exec rake sunspot:solr:stop`
+
+Customization
+=============
+
+Production Server
+-----------------
+To configure development / production solr server edit `$RAILS_ROOT/config/solr.yml`.
+Read the [sunspot documentation](https://github.com/sunspot/sunspot/wiki/Configuring-solr-for-use-with-sunspot-in-development%2C-testing%2C-and-production)
+and [this great post](http://stackoverflow.com/questions/4937314/setup-sunspot-solr-with-rails-in-production-environment) for more information about production configuration.
+
+Below is a sample config for production that works well for a site with relatively low search traffic and capistrano based deployment:
+
+
+ production:
+ solr:
+ hostname: 127.0.0.1
+ bind_address: 127.0.0.1
+ port: 8983
+ log_level: WARNING
+ max_memory: 100M
+ data_path: /data/spree/shared/solr/data
+ pid_dir: /data/spree/shared/solr/pids
+ solr_home: /data/spree/shared/solr
+ auto_commit_after_request: false
-Customize the Facets Shown
---------------------------
+Facets
+------
Edit the [initializer](https://github.com/iloveitaly/spree_sunspot_search/blob/master/lib/generators/templates/spree_sunspot_search.rb) created by the installation script.
The initializer template should provide enough examples to get you started.
@@ -56,6 +80,7 @@ TODO
* Sorting by facet criteria and Solr analytics (Best result, Popular, etc.)
* Open the Sunspot DSL to utilise all the additional data and analytics available through Solr
* Get the Taxon browsing (e.g. Categories) to utilise the Solr data for speed boosts
+* Testing via https://github.com/justinko/sunspot-rails-tester + rspec
Authors
=======
View
1  app/views/spree/products/_sort_bar.html.erb
@@ -5,7 +5,6 @@ if not params.keys.detect { |k| k != 'controller' and k != 'action' }.nil? and p
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
Please sign in to comment.
Something went wrong with that request. Please try again.