为了能够在文本搜索索引中使用子字符串搜索,我使用了以下首选项,但它不适用于波斯文本,而是搜索英文文本效果很好。
创建偏好:
begin
ctx_ddl.create_preference('a_lex', 'AUTO_LEXER');
end;
begin
ctx_ddl.create_preference('mywordlist', 'BASIC_WORDLIST');
ctx_ddl.set_attribute('mywordlist','PREFIX_INDEX','YES');
ctx_ddl.set_attribute('mywordlist','PREFIX_MIN_LENGTH',1);
ctx_ddl.set_attribute('mywordlist','SUBSTRING_INDEX', 'YES');
ctx_ddl.set_attribute('mywordlist','FUZZY_MATCH','AUTO');
ctx_ddl.set_attribute('mywordlist','FUZZY_SCORE','1');
ctx_ddl.set_attribute('mywordlist','FUZZY_NUMRESULTS','5000');
ctx_ddl.set_attribute('mywordlist','STEMMER','AUTO');
end;
索引查询:
create index test on myTable(name)
indextype is ctxsys.context online
parameters (
'SYNC (on commit)
LEXER a_lex
MEMORY 200M
Wordlist mywordlist
') parallel 4;
填充数据:myTable {id:1,名称:رفتن}
select name from myTable where contains(name,'%رفت%')>0