PostgreSQL 全文索引

Posted Ryan.zheng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PostgreSQL 全文索引相关的知识,希望对你有一定的参考价值。

-- 添加全文索引字段并且建立触发器
-- 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 全文索引的主要内容,如果未能解决你的问题,请参考以下文章