我打算使用oracle全文搜索。我正在使用oracle 12c和11g。似乎在创建反向索引时,全文本搜索不会过滤掉停用词。另外,它不会执行词干分析。
create table text_demo (id number primary key, name varchar2(100), description varchar2(4000));
insert into text_demo (id, name, description) values( 1, 'Mike', 'Mike lives in Maryland and attended college at James Madison University');
insert into text_demo (id, name, description) values( 2, 'Joel', 'Joel lives in Ohio and attended college at The Ohio State University');
commit;
create index text_demo_idx1 on text_demo(description) indextype is ctxsys.context;
--searching for word phrase
select * from text_demo where contains( description, 'lives in ohio') > 0;
--1 record returned,as expected
select * from text_demo where contains( description, 'lives ohio') > 0;
--0 record returned. expected 1 record
select * from text_demo where contains( description, 'live in ohio') > 0;
--0 record returned. expected 1 record, lives should stem to live
请让我知道我是否缺少某些东西,或者是否需要明确启用某些功能
答案 0 :(得分:0)
$
运算符是词干运算符,将其与&
结合使用可构成一个短语:
select * from text_demo where contains(description, '$live & $in & $ohio') > 0