|Oracle Text Reference
Part Number A90121-01
CTX_DDL Package, 11 of 28
Creates a zone section and adds the section to an existing section group. This enables zone section searching with the WITHIN operator.
Zone sections are sections delimited by start and end tags. The
</B> tags in HTML, for instance, marks a range of words which are to be rendered in boldface.
Zone sections can be nested within one another, can overlap, and can occur more than once in a document.
Specify the name of the section group to which section_name is added.
Specify the name of the section to add to the group_name. You use this name to identify the section in WITHIN queries. Avoid using names that contain non-alphanumeric characters such as _, since most of these characters are special must be escaped in queries. Section names are case-insensitive.
Within the same group, zone section names and field section names cannot be the same. The terms Paragraph and Sentence are reserved for special sections.
Section names need not be unique across tags. You can assign the same section name to more than one tag, making details transparent to searches.
Specify the pattern which marks the start of a section. For example, if
<H1> is the HTML tag, specify
H1 for tag. The start tag you specify must be unique within a section group.
Oracle knows what the end tags look like from the group_type parameter you specify when you create the section group.
If group_name is an HTML_SECTION_GROUP, you can create zone sections for the META tag's NAME/CONTENT attribute pairs. To do so, specify tag as meta@namevalue where namevalue is the value of the NAME attribute whose CONTENT attributes are to be indexed as a section. Refer to the example.
If group_name is an XML_SECTION_GROUP, you can optionally qualify tag with a document type (root element) in the form (doctype)tag. Doing so makes section_name sensitive to the XML document type declaration. Refer to the example.
The following code defines a section group called
htmgroup of type HTML_SECTION_GROUP. It then creates a zone section in
headline identified by the <H1> tag:
begin ctx_ddl.create_section_group('htmgroup', 'HTML_SECTION_GROUP'); ctx_ddl.add_zone_section('htmgroup', 'heading', 'H1'); end;
After indexing with section group
htmgroup, you can query within the heading section by issuing a query as follows:
You can create zone sections for HTML META tags when you use the HTML_SECTION_GROUP.
Consider an HTML document that has a META tag as follows:
To create a zone section that indexes all CONTENT attributes for the META tag whose NAME value is author:
begin ctx_ddl.create_section_group('htmgroup', 'HTML_SECTION_GROUP'); ctx_ddl.add_zone_section('htmgroup', 'author', 'meta@author'); end
After indexing with section group
htmgroup, you can query the document as follows:
You have an XML document set that contains the
<book> tag declared for different document types. You want to create a distinct book section for each document type.
mydocname is declared as an XML document type (root element) as follows:
mydocname, the element
<book> is declared. For this tag, you can create a section named
mybooksec that is sensitive to the tag's document type as follows:
begin ctx_ddl.create_section_group('myxmlgroup', 'XML_SECTION_GROUP'); ctx_ddl.add_zone_section('myxmlgroup', 'mybooksec', '(mydocname)book'); end;
Zone sections can repeat. Each occurrence is treated as a separate section. For example, if <H1> denotes a
heading section, they can repeat in the same documents as follows:
<H1> The Brown Fox </H1>
<H1> The Gray Wolf </H1>
Assuming that these zone sections are named
Heading, the query Brown WITHIN Heading returns this document. However, a query of (Brown and Gray) WITHIN Heading does not.
Zone sections can overlap each other. For example, if
<I> denote two different zone sections, they can overlap in document as follows:
Zone sections can nest, including themselves as follows:
Using the WITHIN operator, you can write queries to search for text in sections within sections. For example, assume the BOOK1, BOOK2, and AUTHOR zone sections occur as follows in documents doc1 and doc2:
Consider the nested query:
This query returns only doc1.