This repository has been archived by the owner on Jan 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 406
Configuring Search
nihaopaul edited this page Dec 11, 2010
·
12 revisions
Teambox can use Sphinx for indexing and search. Your app needs to have a MySQL or PostgreSQL database in order to have Sphinx perform indexing.
For this, follow the official instructions.
Tested on a clean install of Ubuntu server 10.10
#install from apt-get
apt-get install sphinxsearch
#enable auto start with: START=yes
nano /etc/default/sphinxsearch
#install sphinx gem
gem install sphinx
#run the following from the base to generate the files you need
bundle exec rake ts:index RAILS_ENV=production
bundle exec rake ts:start RAILS_ENV=production
#link the config to auto run without rake starting it up each time
ln -s web/config/production.sphinx.conf /etc/sphinxsearch/sphinx.conf
#kill sphinxsearch which rake started (ps aux | grep sphinx) then start the daemon
service sphinxsearch start
#continue to rebuilding and reindexing below
By default search in Teambox is disabled. You need to modify “config/teambox.yml” in order to enable it:
# Enable search (you must have thinking_sphinx installed and configured)
allow_search: false
Once you have enabled search, you need to generate the search index:
$ bundle exec rake ts:index RAILS_ENV=production
Then simply run the following to start sphinx:
$ bundle exec rake ts:start RAILS_ENV=production
Finally, you will need to periodically update the search index (especially after updating Teambox sources) in order to keep up to date:
$ bundle exec rake ts:rebuild RAILS_ENV=production
You should add a line to your crontab to reindex the database using Sphinx. Something like this would reindex your database every 5 minutes:
*/5 * * * * cd /path/to/teambox && RAILS_ENV=production /usr/bin/env bundle exec rake ts:reindex >> log/cron.log 2>&1