设为首页 加入收藏

TOP

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

zht32tris, zht16mswin950,zht16hkscs,utf8

--建立chinese lexer

Begin

ctx_ddl.create_preference(my_chinese_vgram_lexer, chinese_vgram_lexer);

ctx_ddl.create_preference(my_chinese_lexer, chinese_lexer);

End;

-- chinese_vgram_lexer

Create index ind_m_lex1 on my_lex(docs) indextype is ctxsys.context Parameters (lexer foo.my_chinese_vgram_lexer);

Select * from my_lex t where contains(docs, 中国) > 0;

-- chinese_lexer

drop index ind_m_lex1 force;

Create index ind_m_lex2 on my_lex(docs) indextype is ctxsys.context

Parameters (lexer ctxsys.my_chinese_lexer);

Select * from my_lex t where contains(docs, 中国) > 0;

3.3.4 User_lexer

Use USER_LEXER to plug in your own language-specific lexing solution. This enables you to

define lexers for languages that are not supported by Oracle Text. It also enables you to define a

new lexer for a language that is supported but whose lexer is inappropriate for your application.

3.3.5 Default_lexer

如果数据库在建立的时候指定的是中文则default_lexer 为chinese_vgram_lexer,如果是英文,则default_lexer 为basic_lexer

3.3.6 Query_procedure

This callback stored procedure is called by Oracle Text as needed to tokenize words in the query.

A space-delimited group of characters (excluding the query operators) in the query will be

identified by Oracle Text as a word.

3.3.7 参考脚本

--建立basic_lexer

begin

ctx_ddl.create_preference(mylex, BASIC_LEXER);

ctx_ddl.set_attribute (mylex, printjoins, _-); --保留_ -符号

ctx_ddl.set_attribute (mylex,mixed_case,yes); --区分大小写

end;

create index indx_m_lex on my_lex(docs) indextype is ctxsys.context parameters(lexer

mylex);

--建立 chinese_vgram_lexer 或是chinese_lexer

Begin

ctx_ddl.create_preference(my_chinese_vgram_lexer, chinese_vgram_lexer);

ctx_ddl.create_preference(my_chinese_lexer, chinese_lexer);

End;

-- chinese_vgram_lexer

Create index ind_m_lex1 on my_lex(docs) indextype is ctxsys.context

Parameters (lexer ctxsys.my_chinese_vgram_lexer);

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

评论

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

·如何从内核协议栈到 (2025-12-27 03:19:09)
·什么是网络协议?有哪 (2025-12-27 03:19:06)
·TCP/ IP协议有哪些 (2025-12-27 03:19:03)
·怎样用 Python 写一 (2025-12-27 02:49:19)
·如何学习python数据 (2025-12-27 02:49:16)