Sylph-Searcher - full-text search program for Sylpheed

Copyright (C) 2007 Sylpheed Development Team

What's Sylph-Searcher
=====================

Sylph-Searcher (tentative name) is a full-text search program for messages
stored in the mailboxes of Sylpheed, or generic MH folders.
It utilizes the full-text search feature of PostgreSQL 8.2 (it will work
with 8.1, but 8.2 in which the full-text search feature were improved is
recommended).

Sylph-Searcher is distributed under the BSD license. See COPYING for detail.

Sylph-Searcher requires the following programs:

GLib 2.4.0 or later (http://www.gtk.org/)
GTK+ 2.4.0 or later (http://www.gtk.org/)
MeCab 0.93 or later + mecab-ipadic (http://mecab.sourceforge.net/)
PostgreSQL 8.2 or later + tsearch2 (http://www.postgresql.org/)
LibSylph 1.0.0 or later (http://sylpheed.sraoss.jp/)

Install
=======

First, install GLib, GTK+, MeCab, mecab-ipadic, PostgreSQL,
and tsearch2 (included in PostgreSQL's contrib).
Please refer to each document for their installation.

(Installation of tsearch2)
% cd (PostgreSQL source directory)/contrib/tsearch2
% make
% make install

Next, make Sylph-Searcher and install it. Execute the following in the
source directory of Sylph-Searcher. Executable files are installed into
/usr/local/bin, and SQL scripts are installed into
/usr/local/share/sylph-searcher/sql by default.

% ./configure
% make
% sudo make install

Create an user and a database for Sylph-Searcher (in this example, database
name 'test' with owner 'user' is used), and configure it.
Please note that the database encoding must be UTF-8.

% su postgres
% createuser user
% createdb -O user -E UTF-8 test
% psql test -f /usr/local/pgsql/share/contrib/tsearch2.sql
% psql test -c "GRANT ALL ON pg_ts_cfg TO PUBLIC"
% psql test -c "GRANT ALL ON pg_ts_cfgmap TO PUBLIC"
% psql test -c "GRANT ALL ON pg_ts_dict TO PUBLIC"
% psql test -c "GRANT ALL ON pg_ts_parser TO PUBLIC"
(*1)
% exit

% psql -U user test -f /usr/local/share/sylph-searcher/sql/create.sql
% psql -U user test -f /usr/local/share/sylph-searcher/sql/function.sql

(*1) only do this additionally if the database is initialized with a locale
($LANG) other than "C":
% psql test -c "UPDATE pg_ts_cfg SET locale = '$LANG' where ts_name = 'default'";

How to use
==========

1. Import messages to database

Use syldbimport command to import messages to database. The target folder
must be specified. You can import any type of mailboxes (MH, IMAP4, News).
You can also import MH folders which are not managed by Sylpheed.

You can specify the database to connect or database name by arguments.
Refer to the next section "Command line options" for the options.

* Specify folder by identifier

% syldbimport -d test "#mh/Mailbox/inbox"

* Directly specify MH folder

% syldbimport -d test /path/to/MH/Mailbox

* Recursively import folders under "#mh/Mailbox"

% syldbimport -d test -r "#mh/Mailbox"

* Connect to DB server host:5431 with username 'user' and password 'pass'

% syldbimport -d test -h host -p 5431 -U user -P pass "#mh/Mailbox/another"

* In the case of MeCab dictionary being UTF-8

% syldbimport -d test -U user --mecab-encoding UTF-8 "#mh/Mailbox/foo"
% ...

2. Test DB query

You can perform simple full-text search by syldbquery command.
The query string will be separated into words and messages which include
all of them will match.

% syldbquery -d test -U user "test"

3. Execute GUI front-end

This GUI frontend is mainly used for searching.

Configure database settings with the configuration dialog which will appear
on the first run. You can also specify them by arguments as well as the above
commands.

To execute searching, enter search words in the text entry of targets and
press Enter key, or click 'Find' button. The results are displayed on the
list view at the center. If you select a mesage in the list view, the
message body will be displayed in the text view at the below. If you
double-click the message or press Space or Enter key, it will be displayed
on Sylpheed as a new window (requires Sylpheed 2.4.2 or later).

% sylph-searcher
% sylph-searcher -d test -U user

Command line options
====================

syldbimport [OPTIONS]... target-folder
syldbquery [OPTIONS]... query-string
sylph-searcher [OPTIONS]...

Options for syldbimport, syldbquery and sylph-searcher:

  -d dbname			database name
  -h hostname			hostname of database server
  -p port			port number of database server
  -U username			username for database
  -P password			password for database
  -n				don't remove nonexist messages
  -r				recursive import
  -v				verbose output
  --mecab-encoding encoding	encoding of MeCab dictionary
				(default: Unix: EUC-JP / Win32: Shift_JIS)
