Research on full-text retrieval of Oracle (full 4)

Source: Internet
Author: User

3.4 Section Group attributes

Section group supports querying documents containing internal structures (such as html and xml documents). You can specify

You can limit the query range to the header. In html, xml, and other similar structures

In addition to the content to be displayed, there are also a large number of identifiers used to control the structure. These identifiers may not be indexed, this is a major function of section group (original article: In order to issue WITHIN queries on document sections, you must create a section group before you define your sections)

 

 

 

3.4.1 Null_section_group

The system does not filter any sections by default.

Example:

Create table my_sec (id number, docs varchar2 (100 ));

Insert into my_sec values (1, a simple section group, test null_section_group attribute .);

Insert into my_sec values (2, this record one, can be query in nornal );

Insert into my_sec values (4, this record

Are tested

The query in paragraph );

Commit;

/

-- Define null_section_group

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

Parameters (section group ctxsys. null_section_group );

Select * from my_sec where contains (docs, record and query)> 0;

-- Define sentence or paragraph in advance; otherwise, an error occurs in the query.

Select * from my_sec where contains (docs, (record and query) within sentence)> 0;

Begin

Ctx_ddl.create_section_group (test_null, null_section_group );

Ctx_ddl.add_special_section (test_null, sentence );

Ctx_ddl.add_special_section (test_null, paragraph );

End;

Drop index ind_m_sec;

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

Parameters (section group test_null );

Select * from my_sec where contains (docs, (record and query) within sentence)> 0;

Select * from my_sec where contains (docs, (record and query) within paragraph)> 0;

 

3.4.2 Basic_section_group

Basic_section_group is the most basic attribute that supports node search, but it only supports starting with <tag>

</Tag> structure document

Create table my_sec1 (id number, docs varchar2 (1000 ));

Insert into my_sec1 values (1,

<Context> this is the contents of the example.

Use this example to test the basic_section_group. </context> );

Insert into my_sec1 values (2,

<Context> this line indexing ing the word title too. </context> );

Commit;

/

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

Select * from my_sec1 where contains (docs, heading)> 0;

-- Define basic_section_group

Begin

Ctx_ddl.create_section_group (test_basic, basic_section_group );

End;

Drop index ind_my_sec1;

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

Parameters (section group test_basic );

Select * from my_sec1 where contains (docs, heading)> 0;

Select * from my_sec1 where contains (docs, context)> 0;

Select * from my_sec1 where contains (docs, use)> 0;

Another major function of section search is to limit the scope of the query. The preceding document contains two parts: the title and the body,

The title uses the label

Regional properties, run Query within a certain scope of the document

Drop index ind_my_sec1;

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 );

Select * from my_sec1 where contains (docs, title)> 0;

-- Query in head

Select * from my_sec1 where contains (docs, title within head)> 0;

 

3.4.3 Html_section_group

Html documents have many nonstandard representation methods. We recommend that you use html_section_group in oracle to obtain more

Good Identification

-- Define 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 );

Whether field_section or zone_section, it indicates that the tag label of the document is case sensitive.

Match with the original text

 

3.4.4.Xml _ section_group

Xml documents must be more rigorous and standardized than html documents, which makes the xml_section_group Ratio

Html_section_group has more functions

Example:

Create table my_sec2 (id number, docs varchar2 (1000 ));

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

Commit;

/

-- Define 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 is enhanced. For xml_section_group, you need to add the node group to be defined,

When auto_section_group is used, oracle automatically adds the section group and attribute information.

 

3.4.6 Path_section_group

Similar to auto_section_group, path_section_group adds haspath and

But path_section_group does not support the add_stop_section attribute.

 

3.4.7 reference script

-- Create null_section_group

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

Parameters (section group ctxsys. null_section_group );

-- Create 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); -- sets the section query.

End;

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

Parameters (section group test_basic );

-- Create 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 );

-- Create 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)

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.