我在 Oracle 10g 上使用 Oracle Text。我创建了一个多列上下文索引,如下所示:
我的桌子是
CREATE TABLE WEB_RES
(
"ID" NUMBER(10,0),
"TITLE" VARCHAR2(256 BYTE),
"DESCRIPTION" VARCHAR2(1024 BYTE),
"CONTENT" BLOB,
"CATEGORY" VARCHAR2(64 BYTE),
...
CONSTRAINT "PK_WEB_RES" PRIMARY KEY ("ID")
}
我的偏好和索引是:
execute ctx_ddl.create_preference('my_multi', 'MULTI_COLUMN_DATASTORE');
execute ctx_ddl.set_attribute('my_multi', 'columns', 'title, description, category');
execute ctx_ddl.create_preference( 'my_lexer', 'BASIC_LEXER' );
execute ctx_ddl.set_attribute('my_lexer', 'index_stems', '1');
create index myTitleIndex on web_res(title)
indextype is ctxsys.context
parameters ('DATASTORE my_multi lexer my_lexer SYNC(ON COMMIT)');
我的表中有一行如下:
ID Title Description Category
--- ----------- -------------- ------------
1 Superannuation Contributions Splitting Test Test
英语不是我的母语,但这个查询不应该返回结果吗?
SELECT * FROM web_res WHERE CONTAINS(title, '$contribute', 1) > 0;
我希望在搜索“$Contribute”时找到带有“Contribution”的标题,或者在搜索“$approve”时找到带有“approval”的标题。这不就是词干的意义吗?
编辑: 我也尝试了下面的 Basic_Wordlist,但我的查询仍然没有返回任何行:
execute ctx_ddl.create_preference( 'my_wordlist', 'BASIC_WORDLIST' );
execute ctx_ddl.set_attribute('my_wordlist', 'stemmer', 'ENGLISH');
create index myTitleIndex on web_res(title)
indextype is ctxsys.context
parameters ('DATASTORE my_multi wordlist my_wordlist SYNC(ON COMMIT)');