How to build a mail search engine using Nitro

By Kashia.

Part 1 - Setup

This step assumes you have already installed Ruby, rubygems and PostgreSQL. It also assumes you are on a Unix compatible machine and have sudo handy.
If not, for each command of sudo just log in as root (su).

Nitro

$ sudo gem install nitro -y --no-rdoc
$ sudo gem install ruby-postgres --no-rdoc

Using the -y option takes care of facets, nitro, og and other dependencies.

! Note: this tutorial assumes Nitro version 0.31

TSearch2

Getting TSearch2 is more difficult. Read more at these places:

TSearch2

  • Tsearch V2 Introduction by Andrew J. Kopciuch
  • Tsearch V2 User Guide by Brandon Craig Rhodes
  • Tsearch V2 Reference by Brandon Craig Rhodes

Those three links will be sufficient to make your database TSearch2-aware. The first one is most important, as it explains how to set everything up. Play around, get comfortable.

Help! I don't want too much special SQL T_T

Mh, ok, I understand you're scared now by reading the above documents, or you are scared of SQL in general. I will make it easy for you: for every special syntax I use with PostgreSQL, I will make a small chapter called *Standard SQL* in which I propose a workaround. While the whole SQL part will virtually fall apart to nothing, the Nitro part will have to do more work. And yes, it will be slow!

first
last