| CARVIEW |
ryanb / xapit-sync
- Source
- Commits
- Network (3)
- Issues (7)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
click here to add a description
click here to add a homepage
-
Branches (1)
- master ✓
- Tags (0)
Pledgie Donations
Once activated, we'll place the following badge in your repository's detail box:
Rails plugin to automatically reload a Xapian database when models change. — Read more
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Thu May 28 16:09:44 -0700 2009 | initial structure [ryanb] |
| |
LICENSE | Thu Jun 18 11:10:25 -0700 2009 | generating migration file when installing, and ... [ryanb] |
| |
README.rdoc | Mon Jun 22 13:02:18 -0700 2009 | removing protocol from domains in readme [ryanb] |
| |
Rakefile | Thu May 28 16:09:44 -0700 2009 | initial structure [ryanb] |
| |
app/ | Thu Jun 18 10:06:56 -0700 2009 | adding xapit controller with reload action [ryanb] |
| |
config/ | Thu Jun 18 10:06:56 -0700 2009 | adding xapit controller with reload action [ryanb] |
| |
init.rb | Thu Jun 18 11:28:18 -0700 2009 | fixing typo in init.rb [ryanb] |
| |
install.rb | Thu Jun 18 11:10:25 -0700 2009 | generating migration file when installing, and ... [ryanb] |
| |
lib/ | Mon Jun 22 13:03:34 -0700 2009 | close database when pushing changes to ensure i... [ryanb] |
| |
spec/ | Mon Jun 22 13:03:34 -0700 2009 | close database when pushing changes to ensure i... [ryanb] |
| |
tasks/ | Thu May 28 16:09:44 -0700 2009 | initial structure [ryanb] |
Xapit Sync
Rails plugin which extends Xapit to provide automatic syncing of the index.
For an alternative solution (currently vaporware) see Xapit Server.
github.com/ryanb/xapit-server/tree/master
Installation
This plugin assumes you have a Rails application using Xapit. For more information see: github.com/ryanb/xapit/tree/master
Install the plugin and run migrations.
script/plugin install git://github.com/ryanb/xapit-sync.git rake db:migrate
That is all you need to get started in development, but you should see the customize portion below.
How it Works
Xapit Sync is a Rails plugin designed to update only the Xapian records which have changed and then reload the database automatically.
Each time a Xapit member (model) is created, updated, or destroyed it will record that change in a separate database table.
A separate process will spawn (if it isn’t already running) which updates the Xapian database with all changes recorded. At the end of this process it will trigger a Rails controller/action which is included in the plugin (using Rails metal and/or engines). This will notify the Rails application that the Xapian database needs to be reloaded.
Customize
You will want to customize Xapit Sync to work with your application in production. It is best to do this at the bottom of the setup_xapit.rb initializer file.
If you have your own queuing system (such as delayed_job) it is better to use that instead of the built-in script runner.
class XapitSyncJob
def perform
XapitSync.sync
end
end
# in config/initializers/setup_xapit.rb
XapitSync.override_syncing do
Delayed::Job.enqueue XapitSyncJob.new
end
You can also disable the syncing process in certain environments. For example:
XapitSync.override_syncing { } unless Rails.env.production?
You’ll likely want to customize which domains are triggered when the syncing finishes in order to reload the Xapian database.
XapitSync.domains = ["localhost:8000", "localhost:8001"] if Rails.env.production?
Unfortunately there is not yet a solution to trigger the reloading if you are using Passenger, so you should disable it in that case.
XapitSync.domains = [] if Rails.env.production?
