数据库版本:10g
数据库操作系统: linux as4

表test1,
CREATE TABLE TEST1
(
CHINAME VARCHAR2(4000 CHAR),
ABNAME VARCHAR2(50 CHAR),
ADDRESS VARCHAR2(200 CHAR),
CITY VARCHAR2(30 CHAR),
X NUMBER(10,5),
Y NUMBER(10,5),
POIID NUMBER,
ID NUMBER
)。
指定分词
oracle文档说'chinese_lexer'只能用于utf8字符集,经测试在9i,zhs16gbk,windows也可以。
BEGIN
ctx_ddl . create_preference ( 'my_lexer' , 'chinese_lexer' );
END;
--指定检索的字段
EXEC ctx_ddl . create_preference ( 'mymds' , 'MULTI_COLUMN_DATASTORE' );
EXEC ctx_ddl . set_attribute ( 'mymds' , 'columns' , 'chiname, abname, address, city, x ,y' );
--建索引
CREATE INDEX mc_idx ON test1(CHINAME) INDEXTYPE IS ctxsys.CONTEXT PARAMETERS('datastore mymds LEXER my_lexer')
--测试
select * from test1 where contains ( chiname , '中国' , 1 )> 0
--查看分词结果
select * from DR$MC_IDX$I
--查看错误信息
select * from ctx_user_index_errors

 

0

收藏

gjbxx110

101篇文章,49W+人气,0粉丝