<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>metaduck &#187; Rails</title>
	<atom:link href="http://www.metaduck.com/tag/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.metaduck.com</link>
	<description></description>
	<lastBuildDate>Wed, 05 May 2010 12:04:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Capistrano deploying full text search on Rails using acts_as_xapian</title>
		<link>http://www.metaduck.com/2009/09/capistrano-deploying-full-text-search-on-rails-using-acts_as_xapian/</link>
		<comments>http://www.metaduck.com/2009/09/capistrano-deploying-full-text-search-on-rails-using-acts_as_xapian/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 10:35:22 +0000</pubDate>
		<dc:creator>Pedro Teixeira</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[xapian]]></category>

		<guid isPermaLink="false">http://www.metaduck.com/?p=52</guid>
		<description><![CDATA[acts_as_xapian is a rails plugin for Xapian, a full text search engine.
acts_as_xapian installs the search engine database inside the plugin directory, under xapiandbs. If you use Capistrano as a deployment tool and since the entire codebase is rewritten (including the plugin directory),  you will have to rebuild the entire index every time you do a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/frabcus/acts_as_xapian">acts_as_xapian</a> is a rails plugin for <a href="http://xapian.org/">Xapian</a>, a full text search engine.</p>
<p>acts_as_xapian installs the search engine database inside the plugin directory, under xapiandbs. If you use <a href="http://www.capify.org/">Capistrano</a> as a deployment tool and since the entire codebase is rewritten (including the plugin directory),  you will have to rebuild the entire index every time you do a deployment.</p>
<p><span id="more-52"></span>What you need to do is to locate Xapian somewhere capistrano deployments will not overwrite.</p>
<p>Fortunately you can point the Xapian DB to somewhere else more convenient. Simply create a file under config/xapian.yml. Mine looks like this:</p>
<pre><code>
development:
  base_db_path: xapian/database
staging:
  base_db_path: xapian/database
production:
  base_db_path: xapian/database
</code></pre>
<p>This is telling xapian on the development, staging and production environments to look for the database under the &lt;RAILS_ROOT&gt;/xapian/database.</p>
<p>You will have to create a folder under the deployment shared folder named "xapian/database".</p>
<p>Next you will have to tell Capistrano to relink &lt;RAILS_ROOT&gt;/xapian/database to this shared directory using a Capistrano hook:</p>
<pre><code>
after "deploy:symlink", "deploy:symlink_xapian_db"

...

namespace :deploy do

...

  task :symlink_xapian_db do
    xapian_database_path = 'xapian/database'
    run "mkdir -p #{shared_path}/#{xapian_database_path}"
    run "ln -sf  #{shared_path}/xapian #{release_path}/xapian"
  end

end
</code></pre>
<p>You will only have to build the index once using</p>
<pre><code>'rake xapian:rebuild_index models="ModelName1 ModelName2"'</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.metaduck.com/2009/09/capistrano-deploying-full-text-search-on-rails-using-acts_as_xapian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
