Oracle8i interMedia Text Reference Release 2 (8.1.6) Part Number A77063-01 |
|
CTX_DDL Package, 3 of 24
Creates a field section and adds the section to an existing section group. This enables field section searching with the WITHIN operator.
Field sections are delimited by start and end tags. By default, the text within field sections are indexed as a sub-document separate from the rest of the document.
Unlike zone sections, field sections cannot nest or overlap. As such, field sections are best suited for non-repeating, non-overlapping sections such as TITLE and AUTHOR markup in email- or news-type documents.
Because of how field sections are indexed, WITHIN queries on field sections are usually faster than WITHIN queries on zone sections.
CTX_DDL.ADD_FIELD_SECTION( group_name in varchar2, section_name in varchar2, tag in varchar2, visible in boolean default FALSE );
Specify the name of the section group to which section_name is added. You can add up to 64 field sections to a single section group.
Specify the name of the section to add to the group_name. You use this name to identify the section in queries. Avoid using names that contain non-alphanumeric characters such as _, since these characters 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.
Specify the tag which marks the start of a section. For example, if the tag is <H1>, specify H1.
If group_name is an HTML_SECTION_GROUP, you can create field 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 attribute is to be indexed as a section. Refer to the example.
Specify TRUE to make the text visible within rest of document.
By default the visible flag is FALSE. This means that Oracle indexes the text within field sections as a sub-document separate from the rest of the document. However, you can set the visible flag to TRUE if you want text within the field section to be indexed as part of the enclosing document.
The following code defines a section group basicgroup
of the BASIC_SECTION_GROUP type. It then creates a field section in basicgroup
called Author
for the <A>
tag. It also sets the visible flag to FALSE:
begin ctx_ddl_create_section_group('basicgroup', 'BASIC_SECTION_GROUP'); ctx_ddl.add_field_section('basicgroup', 'Author', 'A', FALSE); end;
Because the Author
field section is not visible, to find text within the Author
section, you must use the WITHIN operator as follows:
'(Martin Luther King) WITHIN Author'
A query of Martin Luther King without the WITHIN operator does not return instances of this term in field sections. If you want to query text within field sections without specifying WITHIN, you must set the visible flag to TRUE when you create the section as follows:
begin ctx_ddl.add_field_section('basicgroup', 'Author', 'A', TRUE); end;
Consider an HTML document that has a META tag as follows:
<META NAME="author" CONTENT="ken">
To create a field section that indexes the CONTENT attribute for the <META NAME="author">
tag:
begin ctx_ddl.add_zone_section('mygroup', 'author', 'meta@author'); end
After indexing with section group mygroup
, you can query the document as follows:
'ken WITHIN author'
Oracle knows what the end tags look like from the group_type parameter you specify when you create the section group. The start tag you specify must be unique within a section group.
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.
You can define up to 64 field sections within a section group. Within the same group, section zone names and section field names cannot be the same.
Field sections cannot be nested. For example, if you define a field section to start with <TITLE>
and define another field section to start with <FOO>
, the two sections cannot be nested as follows:
<TITLE> dog <FOO> cat </FOO> </TITLE>
To work with nested section define them as zone sections.
Repeated field sections are allowed, but WITHIN queries treat them as a single section. The following is an example of repeated field section in a document:
<TITLE> cat </TITLE> <TITLE> dog </TITLE>
The query dog and cat within title returns the document, even though these words occur in different sections.
To have WITHIN queries distinguish repeated sections, define them as zone sections.
"Section Group Types" in Chapter 3.
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|