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

2014-11-24 08:12:01 · 作者: · 浏览: 5
y_sec2 (id number, docs varchar2(1000));

Insert into my_sec2 values (1, context.xml);

commit;

/

--定义xml_section_group

Begin

ctx_ddl.create_preference(test_file, file_datastore);

ctx_ddl.set_attribute(test_file, path, /opt/tmp);

ctx_ddl.create_section_group(test_html, html_section_group);

ctx_ddl.create_section_group(test_xml, xml_section_group);

End;

Create index ind_t_docs on my_sec2 (docs) indextype is ctxsys.context

parameters(datastore ctxsys.test_file filter ctxsys.null_filter section group

ctxsys.test_xml)

Begin

ctx_ddl.add_attr_section(test_xml, name, const@name);

End;

Select * from my_sec2 where contains (docs, complete within name) > 0;

3.4.5.Auto_section_group

Xml_section_group 的增强型,对于xml_section_group 用户需要自己添加需要定义的节组,

而使用auto_section_group,则oracle 会自动添加节组以及属性信息

3.4.6 Path_section_group

和auto_section_group 十分类似,path_section_group 比auto_section_group 增加了haspath 和

inpath 操作,但是path_section_group 不支持add_stop_section 属性

3.4.7 参考脚本

--建立null_section_group

Create index ind_m_sec on my_sec(docs) indextype is ctxsys.context

parameters (section group ctxsys.null_section_group);

--建立basic_section_group

Begin

Ctx_ddl.create_section_group(test_basic, basic_section_group);

End;

Begin

ctx_ddl.add_zone_section(test_basic, head, heading); --设定节查询

End;

Create index ind_my_sec1 on my_sec1(docs) indextype is ctxsys.context

parameters (section group test_basic);

--建立Html_section_group

begin

ctx_ddl.create_section_group(htmgroup, HTML_SECTION_GROUP);

end;

create index myindex on docs(htmlfile) indextype is ctxsys.context

parameters(filter ctxsys.null_filter section group htmgroup);

--建立Xml_section_group

Begin

ctx_ddl.create_section_group(test_xml, xml_section_group);

End;

Create index ind_t_docs on my_sec2 (docs) indextype is ctxsys.context

parameters(filter ctxsys.null_filter section group ctxsys.test_xml)