Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anthonator/delayed_sunspot
Delayed Job support for Sunspot
https://github.com/anthonator/delayed_sunspot
Last synced: 6 days ago
JSON representation
Delayed Job support for Sunspot
- Host: GitHub
- URL: https://github.com/anthonator/delayed_sunspot
- Owner: anthonator
- License: mit
- Created: 2012-11-04T09:24:04.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2012-11-05T06:55:51.000Z (about 12 years ago)
- Last Synced: 2024-10-12T03:53:08.222Z (about 1 month ago)
- Language: Ruby
- Size: 111 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# DelayedSunspot [![endorse](http://api.coderwall.com/anthonator/endorsecount.png)](http://coderwall.com/anthonator)
Adds support for indexing objects asynchronously using [Sunspot](https://github.com/sunspot/sunspot) and [Delayed Job](https://github.com/collectiveidea/delayed_job).
[![Build Status](https://secure.travis-ci.org/anthonator/delayed_sunspot.png)](http://travis-ci.org/anthonator/delayed_sunspot)
## 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.
```ruby
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:
```xml
10000
15000```
To find out more about autocommits [read the Solr documentation](http://wiki.apache.org/solr/SolrConfigXml#Update_Handler_Section)
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