ALTER TABLE companies
ADD COLUMN fti_business tsvector; UPDATE companies SET fti_business = to_tsvector('default',business_model);
VACUUM FULL ANALYZE companies;
CREATE INDEX idx_fti_business ON companies USING gist(fti_business);
CREATE TRIGGER tg_fti_companies
BEFORE UPDATE OR INSERT ON companies
FOR EACH ROW EXECUTE PROCEDURE
tsearch2(fti_business, business_model);
SELECT company_name, business_model
FROM companies
WHERE fti_business @@
to_tsquery('default','bushing | engine');
URL: http://www.opennet.dev/opennews/art.shtml?num=3801
Обсуждается: http://www.opennet.dev/tips/info/677.shtml