dbTalk Databases Forums  

TSEARCH2 disable stemming, triggers

comp.databases.postgresql comp.databases.postgresql


Discuss TSEARCH2 disable stemming, triggers in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Erwin Moller
 
Posts: n/a

Default TSEARCH2 disable stemming, triggers - 05-30-2007 , 07:00 AM






Hi group,

I installed TSEARCH2 on Postgres8.1 (Debian).
It runs all fine.
I have 2 tables indexed, and created triggers to keep the vectorcolumns up
to date.

However, the text I indexed is a mix of Dutch and English and German.
The default stemmingprocess is an annoyance for me.
I would like to disable it.
I found out that using 'simple' instead of 'default' when using
to_tsvector() does excactly that, but I don't know how to change my
triggers and indexes to keep doing the same (using 'simple').

My TSEARCH2 and trigger-skills are developing, but I lack the confidence to
change thing on the site (which is live), so I thought I check in here.

I have a table named tblvacature, that contains a bunch of columns that need
to be indexed by TSEARCH.

This is what I did (and it works, except for the fact I want to disable
stemming)

1) ALTER TABLE tblvacature ADD COLUMN idxFTI tsvector;
2) UPDATE tblvacature SET idxFTI=to_tsvector('simple',
coalesce(title,'') ||' '||
coalesce(shortintro,'') ||' '||
coalesce(werkgever,'') ||' '||
coalesce(vacaturesteller,'') ||' '||
coalesce(standplaats,'') ||' '||
coalesce(divafdelingwerkgever,'') );

3) VACUUM FULL ANALYZE;

4) CREATE INDEX idxFTIvacture_idx ON tblvacature USING gist(idxFTI);

5) VACUUM FULL ANALYZE;

6) CREATE TRIGGER tsvectorupdate_vacature BEFORE UPDATE OR INSERT ON
tblvacature FOR EACH ROW EXECUTE
PROCEDURE tsearch2(idxFTI, title, shortintro, werkgever, vacaturesteller,
standplaats, divafdelingwerkgever);


Step 2 worked fine: no stemming.
But how do I cange my step6 (trigger) so it keeps using 'simple'?
Or do I have to change the index itself (step4) too? Or both?

Please advise.

Thanks for your time.

Regards,
Erwin Moller

Reply With Quote
  #2  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: TSEARCH2 disable stemming, triggers - 05-31-2007 , 04:33 AM






Erwin Moller wrote:
Quote:
I installed TSEARCH2 on Postgres8.1 (Debian).
It runs all fine.
I have 2 tables indexed, and created triggers to keep the vectorcolumns up
to date.

However, the text I indexed is a mix of Dutch and English and German.
The default stemmingprocess is an annoyance for me.
I would like to disable it.
I found out that using 'simple' instead of 'default' when using
to_tsvector() does excactly that, but I don't know how to change my
triggers and indexes to keep doing the same (using 'simple').
If nobody here knows it, try to ask the psql-general mailing list:

http://mail.postgresql.org/mj/mj_www...=pgsql-general

Yours,
Laurenz Albe


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.