设为首页 加入收藏

TOP

Oracle全文检索方面的研究(全8)
2014-11-24 08:12:02 来源: 作者: 【 】 浏览:2
Tags:Oracle 全文检索 面的 研究

3.9 Highlighting 高亮显示

并不是说将内容高亮显示,而是返回所有命中词在文档中的位置和命中词本身的长度。

这样用户在得到文档的同时,还得到了需要高亮显示的内容的长度和偏移量,真正的显示工作需要由用户来完成(原文:In Oracle Text query applications, you can present selected

documents with query terms highlighted for text queries or with themes highlighted for ABOUT

queries)

例子:

Create table my_high (id number primary key, docs varchar2(1000));

insert into my_high values (1, this is a oracle text example. And oracle is the key word.);

insert into my_high values (2, oracle text

2 this is a oracle ctx_doc hightlight example.);

commit;

/

--建立索引

create index ind_m_high on my_high(docs) indextype is ctxsys.context;

--返回结果的偏移量

set serverout on

declare

v_restab ctx_doc.highlight_tab;

begin

ctx_doc.highlight(ind_m_high, 1, oracle, v_restab, true);

for i in 1..v_restab.count loop

dbms_output.put_line(begin with: || v_restab(i).offset || length: || v_restab(i).length);

end loop;

end;

begin with: 11 length: 6

begin with: 36 length: 6

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Oracle全文检索方面的研究(全7) 下一篇Oracle全文检索方面的研究(全5)

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·如何理解c语言指针和 (2025-12-27 01:19:11)
·为什么C标准库没有链 (2025-12-27 01:19:08)
·玩转C语言和数据结构 (2025-12-27 01:19:05)
·MySQL 基础入门视频 (2025-12-26 23:20:22)
·小白入门:MySQL超详 (2025-12-26 23:20:19)