Oracle全文检索方面的研究(全7)(2)
Select * from my_stop where contains(docs, stopthemes) > 0;
--往默认词库中添加停用词
conn ctxsys/ctxsys;
Begin
ctx_ddl.add_stopword(default_stoplist, stopthemes); --增加停用词
ctx_ddl.add_stopword(default_stoplist, words);
ctx_ddl.remove_stopword(default_stoplist, words);--删除停用词
End;
--添加后需重新建立索引才能生效
conn oratext/oratext;
drop index ind_m_word;
Create index ind_m_word on my_stop(docs) indextype is ctxsys.context
Parameters (lexer test_b_lexer stoplist ctxsys.default_stoplist);
Select * from my_stop where contains(docs, words) > 0;
Select * from my_stop where contains(docs, stopthemes) > 0;
--相关数据字典
Select * from ctx_preferences where pre_name = DEFAULT_LEXER;
Select * from ctx_stopwords where spw_stoplist = DEFAULT_STOPLIST;
3.7.4 multi_stoplist
多语言停用词,适用在文档中包含不同的语言(A multi-language stoplist is useful when you use
the MULTI_LEXER to index a table that contains documents in different languages, such as
English, German, and Japanese)
增加停用词时,可以为停用词指定某种语言,只对指定的语言生效,默认情况下停用词对任
何语言都是生效的。
--建立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
相关新闻>>
- 发表评论
-
- 最新评论 更多>>