首页 > 数据库技术 > 详细

PostgreSQL 全文索引

时间:2018-05-29 16:48:36      阅读:143      评论:0      收藏:0      [点我收藏+]
-- 添加全文索引字段并且建立触发器
-- alter table keyword add COLUMN tsv tsvector;

-- create or replace function keyword_ts_trigger_function() returns trigger as $$
-- begin
--     new.keyword_participle := to_tsvector(english_nostop,COALESCE(new.keyword,‘‘) );
--     return new;
--    end
--    $$ language plpgsql;
-- 
--     create trigger messages_ts_trigger
--         before insert 
--         on keyword
--         for each row
--         execute procedure keyword_ts_trigger_function();
-- 创建索引
-- CREATE INDEX keyword_full_text_index on keyword 
-- using gin(to_tsvector(english_nostop,keyword));
-- 更新刚刚创建的字段
--

参考文章:

https://stackoverflow.com/questions/1497895/can-i-configure-stop-words-programmatically-with-postgresql-full-text-search

https://www.youtube.com/watch?v=LS6kF43DEt8

 

PostgreSQL 全文索引

原文:https://www.cnblogs.com/ryanzheng/p/9105773.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!