Oracle全文检索方面的研究(全7)(二)

2014-11-24 08:13:47 · 作者: · 浏览: 6
认情况下停用词对任

何语言都是生效的。

--建立multi_stoplist

begin

ctx_ddl.create_stoplist(multistop1, MULTI_STOPLIST);

ctx_ddl.add_stopword(multistop1, Die, german);

ctx_ddl.add_stopword(multistop1, Or, english);

end;

添加停用词,同步索引后发现还是能查到,需要重新建立索引才能生效。

3.7.5 参考脚本

--建立stoplist:

Begin

Ctx_ddl.create_stoplist(test_stoplist, basic_stoplist);

End;

--删除stoplist:

begin

ctx_ddl.drop_stoplist( test_stoplist );

end;

--增加停用词

ctx_ddl.add_stopword(default_stoplist, stopthemes); --增加停用词

--删除停用词

ctx_ddl.remove_stopword(default_stoplist, words);--删除停用词

3.8 Theme 主题查询

主题查询的概念是根据文档的含义,而不仅仅是根据某个词的匹配程度来返回查询结果

的。比如查询about(’US politics’)可能会返回‘US presidential elections’ 和 ‘US foreign

policy’之类的结果(原文:An ABOUT query is a query on a document theme. A document theme

is a concept that is sufficiently developed in the text. For example, an ABOUT query on US politics

might return documents containing information about US presidential elections and US foreign

policy. Documents need not contain the exact phrase US politics to be returned.)

10g 只支持两种主题查询语言:English,French

例子:

--在context 中启用主题查询

BEGIN

CTX_DDL.CREATE_PREFERENCE(TEST_ABOUT, BASIC_LEXER);

CTX_DDL.SET_ATTRIBUTE(TEST_ABOUT, INDEX_THEMES, YES);

CTX_DDL.SET_ATTRIBUTE(TEST_ABOUT, INDEX_TEXT, YES);

END;

CREATE INDEX IND_m_about ON my_about(DOCS) INDEXTYPE IS CTXSYS.CONTEXT

PARAMETERS (LEXER CTXSYS.TEST_ABOUT);

--查询

SELECT * FROM my_about WHERE CONTAINS(DOCS, ABOUT(US politics)) > 0;