Oracle 包含无法处理包含 "not" 个词的短语
Oracle Contains failed working for phrase containing "not" word
我正在尝试在 table 中搜索类似 'not placed' 的短语,其中 col 由 "indextype is ctxsys.context"
索引
select * from
table
where contains (col, 'not placed')>0
没有 "NOT" 字词,搜索工作绝对正常,没有任何问题。
一旦在搜索短语中添加 "not",就会引发以下问题 -
ORA-29902: error in executing ODCIIndexStart() routine
ORA-20000: Oracle Text error:
DRG-50901: text query parser syntax error on line 1, column 1
29902. 00000 - "error in executing ODCIIndexStart() routine"
*Cause: The execution of ODCIIndexStart routine caused an error.
*Action: Examine the error messages produced by the indextype code and
take appropriate action.
我什至尝试对 "not" 单词使用转义序列,但它无法识别 "not" 单词本身
not
是 not
运算符的保留字。您需要转义它才能使用 contains
搜索此值。通过将其括在大括号 {}
.
中来做到这一点
它也是默认停用词之一。这些不包括在索引中。
这将创建一个具有空停止列表的索引。所以它包括每一个字:
create table t (
c1 varchar2(100)
);
insert into t values ( 'placed' );
insert into t values ( 'not placed' );
insert into t values ( 'something else' );
insert into t values ( 'file is placed in folder' );
insert into t values ( 'file is not placed in folder' );
commit;
create index i
on t ( c1 )
indextype is ctxsys.context
parameters (
'stoplist ctxsys.empty_stoplist sync(on commit)'
);
select * from t
where contains (c1, 'placed') > 0;
C1
placed
not placed
file is placed in folder
file is not placed in folder
select * from t
where contains (c1, 'not placed') > 0;
ORA-29902: error in executing ODCIIndexStart() routine
ORA-20000: Oracle Text error:
DRG-50901: text query parser syntax error on line 1, column 1
select * from t
where contains (c1, '{not} placed') > 0;
C1
not placed
file is not placed in folder
但您可能想创建自己的 custom stop list。
我正在尝试在 table 中搜索类似 'not placed' 的短语,其中 col 由 "indextype is ctxsys.context"
索引select * from
table
where contains (col, 'not placed')>0
没有 "NOT" 字词,搜索工作绝对正常,没有任何问题。
一旦在搜索短语中添加 "not",就会引发以下问题 -
ORA-29902: error in executing ODCIIndexStart() routine
ORA-20000: Oracle Text error:
DRG-50901: text query parser syntax error on line 1, column 1
29902. 00000 - "error in executing ODCIIndexStart() routine"
*Cause: The execution of ODCIIndexStart routine caused an error.
*Action: Examine the error messages produced by the indextype code and
take appropriate action.
我什至尝试对 "not" 单词使用转义序列,但它无法识别 "not" 单词本身
not
是 not
运算符的保留字。您需要转义它才能使用 contains
搜索此值。通过将其括在大括号 {}
.
它也是默认停用词之一。这些不包括在索引中。
这将创建一个具有空停止列表的索引。所以它包括每一个字:
create table t (
c1 varchar2(100)
);
insert into t values ( 'placed' );
insert into t values ( 'not placed' );
insert into t values ( 'something else' );
insert into t values ( 'file is placed in folder' );
insert into t values ( 'file is not placed in folder' );
commit;
create index i
on t ( c1 )
indextype is ctxsys.context
parameters (
'stoplist ctxsys.empty_stoplist sync(on commit)'
);
select * from t
where contains (c1, 'placed') > 0;
C1
placed
not placed
file is placed in folder
file is not placed in folder
select * from t
where contains (c1, 'not placed') > 0;
ORA-29902: error in executing ODCIIndexStart() routine
ORA-20000: Oracle Text error:
DRG-50901: text query parser syntax error on line 1, column 1
select * from t
where contains (c1, '{not} placed') > 0;
C1
not placed
file is not placed in folder
但您可能想创建自己的 custom stop list。