当前位置: 代码迷 >> Oracle技术 >> oracle11g 全文搜索有关问题
  详细解决方案

oracle11g 全文搜索有关问题

热度:71   发布时间:2016-04-24 08:34:27.0
oracle11g 全文搜索问题
用下面的办法创建的全文索引。但是在搜索的时候确不全面

比如,查询关键字是“东莞”和“东”时,能查到数据,而用“大朗”时能查到数据,但用“大”时却查不到了


这是怎么回事,要怎么改进?

Begin
  Begin
ctx_ddl.drop_preference('cn_lexer');
  Exception
  When Others Then
  dbms_output.put_line('cn_lexer 不存在');
  End;
  Begin 
ctx_ddl.drop_preference('cn_wordlist');
  Exception 
  When Others Then
  dbms_output.put_line('cn_wordlist 不存在');
  End;
   
  ctx_ddl.create_preference('cn_lexer', 'chinese_lexer');
   
  ctx_ddl.create_preference('cn_wordlist', 'BASIC_WORDLIST');
  ctx_ddl.set_attribute('cn_wordlist', 'PREFIX_INDEX', 'TRUE');
  ctx_ddl.set_attribute('cn_wordlist', 'PREFIX_MIN_LENGTH', '1');
  ctx_ddl.set_attribute('cn_wordlist', 'PREFIX_MAX_LENGTH', '5');
  ctx_ddl.set_attribute('cn_wordlist', 'SUBSTRING_INDEX', 'YES');
   
  --ctx_ddl.create_index_set('testdata_iset');
  --ctx_ddl.add_index('testdata_iset', 'pid');
  --ctx_ddl.add_index('testdata_iset', 'cid');
  --ctx_ddl.add_index('testdata_iset', 'aid');
End;



-- Drop Index idx_testdata_title;

Create Index idx_testdata_title On testdata(title) Indextype Is ctxsys.ctxcat
  Parameters('lexer zhimin.cn_lexer index set testdata_iset wordlist zhimin.cn_wordlist');



------解决方案--------------------
参考一下这篇博文:http://blog.csdn.net/hunterdiary/article/details/4043099
------解决方案--------------------
我用oracle10对文件系统上的文件做索引时发现,文件名不能是中文,还则索引不到。
  相关解决方案