Re: Install Tsearch2

From: Jeff Frost <jeff(at)frostconsultingllc(dot)com>
To: "Alexander B(dot)" <burbello3000(at)yahoo(dot)com(dot)br>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Install Tsearch2
Date: 2007-02-01 19:25:11
Message-ID: Pine.LNX.4.64.0702011122110.6080@discord.home.frostconsultingllc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I believe I followed these instructions the last time I enabled tsearch2:

http://www.sai.msu.su/~megera/wiki/tsearch-v2-intro

These are my crib notes for the English version, you'll have to update paths
etc:

wget http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/dicts/ispell/ispell-english.tar.gz
cd /usr/local/lib
sudo tar xvfz /usr/local/src/TARFILES/ispell-english.tar.gz

psql -f /usr/share/pgsql/contrib/tsearch2.sql ftstest

INSERT INTO pg_ts_cfg (ts_name , prs_name, locale ) values ( 'default_english', 'default', 'en_US');

INSERT INTO pg_ts_dict
(SELECT 'en_ispell',
dict_init,
'DictFile="/usr/local/lib/english.dict",'
'AffFile="/usr/local/lib/english.aff",'
'StopFile="/usr/share/pgsql/contrib/english.stop"',
dict_lexize
FROM pg_ts_dict
WHERE dict_name = 'ispell_template');

INSERT INTO pg_ts_cfgmap (ts_name, tok_alias, dict_name)
VALUES ('default_english', 'lhword', '{en_ispell,en_stem}');
INSERT INTO pg_ts_cfgmap (ts_name, tok_alias, dict_name)
VALUES ('default_english', 'lpart_hword', '{en_ispell,en_stem}');
INSERT INTO pg_ts_cfgmap (ts_name, tok_alias, dict_name)
VALUES ('default_english', 'lword', '{en_ispell,en_stem}');

INSERT INTO pg_ts_cfgmap
VALUES ('default_english', 'url', '{simple}');
INSERT INTO pg_ts_cfgmap
VALUES ('default_english', 'host', '{simple}');
INSERT INTO pg_ts_cfgmap
VALUES ('default_english', 'sfloat', '{simple}');
INSERT INTO pg_ts_cfgmap
VALUES ('default_english', 'uri', '{simple}');
INSERT INTO pg_ts_cfgmap
VALUES ('default_english', 'int', '{simple}');
INSERT INTO pg_ts_cfgmap
VALUES ('default_english', 'float', '{simple}');
INSERT INTO pg_ts_cfgmap
VALUES ('default_english', 'email', '{simple}');
INSERT INTO pg_ts_cfgmap
VALUES ('default_english', 'word', '{simple}');
INSERT INTO pg_ts_cfgmap
VALUES ('default_english', 'hword', '{simple}');
INSERT INTO pg_ts_cfgmap
VALUES ('default_english', 'nlword', '{simple}');
INSERT INTO pg_ts_cfgmap
VALUES ('default_english', 'nlpart_hword', '{simple}');
INSERT INTO pg_ts_cfgmap
VALUES ('default_english', 'part_hword', '{simple}');
INSERT INTO pg_ts_cfgmap
VALUES ('default_english', 'nlhword', '{simple}');
INSERT INTO pg_ts_cfgmap
VALUES ('default_english', 'file', '{simple}');
INSERT INTO pg_ts_cfgmap
VALUES ('default_english', 'uint', '{simple}');
INSERT INTO pg_ts_cfgmap
VALUES ('default_english', 'version', '{simple}');

ALTER TABLE album ADD COLUMN idxFTI tsvector;
UPDATE album SET idxFTI=to_tsvector(name);
CREATE INDEX album_idxFTI_idx ON album USING gist(idxFTI);

CREATE TRIGGER album_tsvectorupdate BEFORE UPDATE OR INSERT ON album
FOR EACH ROW EXECUTE PROCEDURE tsearch2(idxFTI, name);

SELECT * FROM album WHERE idxfti @@ to_tsquery('spiderman');

Hopefully that helps...

On Thu, 1 Feb 2007, Alexander B. wrote:

> Hi,
>
> I need to install tsearch2, but I couldn't find a procedure (step-by-step).
> Could you recomend some site or some steps to install.
>
> I used PG 8 on Suse and Debian, and I installed postgres by source.
>
> Thanks in advance.
>
>
>
>
>
> _______________________________________________________
> Yahoo! Mail - Sempre a melhor opo para voc!
> Experimente j e veja as novidades.
> http://br.yahoo.com/mailbeta/tudonovo/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
> http://www.postgresql.org/about/donate
>
>

--
Jeff Frost, Owner <jeff(at)frostconsultingllc(dot)com>
Frost Consulting, LLC http://www.frostconsultingllc.com/
Phone: 650-780-7908 FAX: 650-649-1954

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Shoaib Mir 2007-02-01 19:28:55 Re: Install Tsearch2
Previous Message Alexander B. 2007-02-01 19:16:42 Install Tsearch2