0.0
No commit activity in last 3 years
No release in over 3 years
Delayed Job support for Sunspot
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

DelayedSunspot endorse

Adds support for indexing objects asynchronously using Sunspot and Delayed Job.

Build Status

Installation

Add this line to your application's Gemfile:

gem 'delayed_sunspot'

And then execute:

$ bundle

Or install it yourself as:

$ gem install delayed_sunspot

Usage

You will need to configure Sunspot to use delayed_sunspot's session proxy in order to push Sunspot commands through Delayed Job.

Sunspot.session = Sunspot::SessionProxy::DelayedJobSessionProxy.new(Sunspot.session)

If you're using Rails put the above line of code in an initializer.

ZOMG! WHY AREN'T MY OBJECTS BEING INDEXED?!

If you're using the sunspot_rails gem you might have noticed that the objects you've been indexing aren't coming back in your search results. This is due to the sunspot_rails gem being configured to autocommit indexes through a controller hook. This functionality doesn't exist when indexing outside of a controller.

You can enable autocommit by putting the following code in your solrconfig.xml under the updateHandler section:

<autoCommit>
    <maxDocs>10000</maxDocs> <!-- maximum uncommited docs before autocommit triggered -->
    <maxTime>15000</maxTime> <!-- maximum time (in MS) after adding a doc before an autocommit is triggered -->
</autoCommit>

To find out more about autocommits read the Solr documentation

If you've already configured Solr for autocommits you're good to go.

Asynchronous Commands

batch
commit
commit_if_delete_dirty
commit_if_dirty
index
index!
remove
remove!
remove_all
remove_all!
remove_by_id
remove_by_id!

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request