加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

PostgreSQL 全文索引

发布时间:2020-12-13 16:12:02 所属栏目:百科 来源:网络整理
导读:-- 添加全文索引字段并且建立触发器 -- 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 ‘ ,C
-- 添加全文索引字段并且建立触发器
-- 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,keyword));
-- 更新刚刚创建的字段
-- update keyword set tsv = to_tsvector(‘english_nostop‘,COALESCE(keyword,‘‘));

参考文章:

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

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读