Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Rails plugin to automatically reload a Xapian database when models change.
Branch: master


Xapit Sync

Rails plugin which extends Xapit to provide automatic syncing of the index.

For an alternative solution (currently vaporware) see Xapit Server.


This plugin assumes you have a Rails application using Xapit. For more information see:

Install the plugin and run migrations.

script/plugin install 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.


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

# in config/initializers/setup_xapit.rb
XapitSync.override_syncing do

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. = ["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. = [] if Rails.env.production?
Something went wrong with that request. Please try again.