Skip to content

greendog/spree_elasticsearch

 
 

Repository files navigation

Spree Elasticsearch

This extension uses elasticsearch-ruby for integration of Elasticsearch with Spree. This is preconfigured for a certain use case, but by all means override where necessary.

To understand what is going on, you should first learn about Elasticsearch. Some great resources:

Installation

Add spree_elasticsearch to your Gemfile:

gem 'spree_elasticsearch'

Bundle your dependencies and run the installation generator:

bundle
bundle exec rails g spree_elasticsearch:install

Edit/create the file in config\elasticsearch.yml to match your configuration.

Create a decorator for Product model to implement callbacks and update the index. Check the elasticsearch-rails documentation for different options.

For example using the model callbacks

module Spree
  Product.class_eval do
    include Elasticsearch::Model::Callbacks  
  end
end

Elasticsearch

Elasticsearch is very easy to install. Get and unzip elasticsearch 1.x.x: http://www.elasticsearch.org/download

Start:

bin/elasticsearch

Execute following to drop index (all) and have a fresh start:

curl -XDELETE 'http://localhost:9200'

Elasticsearch has a nifty plugin, called Marvel, you can install to view the status of the cluster, but which can also serve as a tool to debug the commands you're running against the cluser. This tool is free for development purposes, but requires a license for production environments. You can install it by executing the following.

bin/plugin -i elasticsearch/marvel/latest

Testing

Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.

bundle
bundle exec rake test_app
bundle exec rspec spec

When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:

require 'spree_elasticsearch/factories'

Copyright (c) 2014 Jan Vereecken, released under the New BSD License

About

Integration with Elasticsearch for the Spree framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 85.1%
  • HTML 12.5%
  • CSS 2.2%
  • JavaScript 0.2%