数据库首先要有CTXSYS用户和CTXAPP角色
数据库用户赋予CTXAPP角色
确保Oracle服务器上lsnrctl中PLSExtProc服务为启动状态


create table tbl_1 (id int primary key,title varchar2(2000),cont blob);
插入N条记录
begin
ctx_ddl.create_preference ('my_lexer', 'chinese_vgram_lexer');
end;
CREATE INDEX qidx_tbl_1_1 ON tbl_1 ( title ) INDEXTYPE IS ctxsys.CONTEXT parameters('lexer my_lexer')
CREATE INDEX qidx_tbl_1_2 ON tbl_1 ( cont ) INDEXTYPE IS ctxsys.CONTEXT parameters('lexer my_lexer')

检索
select * from tbl_1 where contains(title,'查找内容')>0;
select * from tbl_1 where contains(cont,'查找内容')>0;

同步
exec   ctx_ddl.sync_index('qidx_tbl_1_1');
exec   ctx_ddl.sync_index('qidx_tbl_1_2');

缺陷

两个全文索引最好不要使用or关联,否则效率很低
查找内容只能是与词法分析器所人为的单词进行匹配
比如查找 title可以,但却查不了t。
想想也是,否则效率岂不是太低了。呵呵

相关文章:

  • 2021-05-28
  • 2021-09-08
  • 2021-07-22
  • 2022-12-23
  • 2021-05-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
猜你喜欢
  • 2021-10-06
  • 2022-01-31
  • 2022-12-23
  • 2021-05-16
  • 2021-12-19
  • 2021-06-17
  • 2022-01-12
相关资源
相似解决方案