Giter VIP home page Giter VIP logo

sunspot-queue's Introduction

sunspot-queue Build Status

Background search indexing using existing worker systems.

Install

$ gem install sunspot-queue

Usage with Rails and Resque

In your Gemfile

gem "sunspot-queue"
gem "resque"

In config/initializers/sunspot.rb

require "sunspot/queue/resque"
backend = Sunspot::Queue::Resque::Backend.new
Sunspot.session = Sunspot::Queue::SessionProxy.new(Sunspot.session, backend)

Start Resque

$ QUEUE=sunspot rake resque:work

Usage with Rails and Sidekiq

In your Gemfile

gem "sunspot-queue"
gem "sidekiq"

In config/initializers/sunspot.rb

require "sunspot/queue/sidekiq"
backend = Sunspot::Queue::Sidekiq::Backend.new
Sunspot.session = Sunspot::Queue::SessionProxy.new(Sunspot.session, backend)

Start Sidekiq

$ sidekiq -q sunspot

Usage with Rails and Delayed::Job

In your Gemfile

gem "sunspot-queue"
gem "delayed_job"
gem "delayed_job_active_record"     # or choose another backend

In config/initializers/sunspot.rb

require "sunspot/queue/delayed_job"
backend = Sunspot::Queue::DelayedJob::Backend.new
Sunspot.session = Sunspot::Queue::SessionProxy.new(Sunspot.session, backend)

Start Delayed::Job

$ rake jobs:work 

Configuring Sunspot Queue

In config/initializers/sunspot.rb

Sunspot::Queue.configure do |config|
  # Override default job classes
  config.index_job   = CustomIndexJob
  config.removal_job = CustomRemovalJob
end

Configuring Auto Commit

The sunspot-queue jobs update the Solr index but those changes don't appear in search results until Solr commits those changes. Solr supports automatically commiting changes based on either the number of changes and / or time between commits.

Add (or uncomment) the following in solrconfig.xml

<autoCommit>
  <maxDocs>10000</maxDocs>
  <maxTime>30000</maxTime>
</autoCommit>

See Solr's documentation for more information.

Note on Patches/Pull Requests

  • Fork the project.
  • Add tests to show the problem or test your feature
  • Make your feature addition or bug fix.
  • Send me a pull request. Bonus points for topic branches.

Please don't make changes to the Rakefile, version, or history.

Development

$ gem install bundler
$ bundle
$ guard

Copyright

See LICENSE for details.

sunspot-queue's People

Contributors

gaffneyc avatar quake avatar djmaze avatar zdennis avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.