Previous | Next |
Tsearch2 README File Example: Overview (Continued)Currently if we insert or update a line in the ts_readme table, we have to remember to also update the ts_vec column. Tsearch comes with a trigger function, tsearch2(), to do this automatically. CREATE TRIGGER ts_readme_ts_vec_update BEFORE UPDATE OR INSERT ON ts_readme FOR EACH ROW EXECUTE PROCEDURE tsearch2(ts_vec, line); INSERT INTO ts_readme (line_number, line) VALUES (211, 'Adding another line to tsearch readme file.'); SELECT * FROM ts_readme WHERE line_number = 211; -[ RECORD 1 ]--------------------------------------------------------- line_number | 211 line | Adding another line to tsearch readme file. ts_vec | 'ad':1 'file':7 'line':3 'anoth':2 'readm':6 'tsearch':5 |