ADD_SPECIAL_SECTION
Adds a special section, either SENTENCE or PARAGRAPH, to a section group. This enables searching within sentences or paragraphs in documents with the WITHIN operator.
A special section in a document is a section which is not explicitly tagged like zone and field sections. The start and end of special sections are detected when the index is created. Oracle Text supports two such sections: paragraph and sentence.
The sentence and paragraph boundaries are determined by the lexer. For example, the lexer recognizes sentence and paragraph section boundaries as follows:
Table 1 Paragraph and Sentence Section Boundaries
| Special Section | Boundary |
|---|---|
| SENTENCE | WORD/PUNCT/WHITESPACE |
| SENTENCE | WORD/PUNCT/NEWLINE |
| PARAGRAPH | WORD/PUNCT/NEWLINE/WHITESPACE (indented paragraph) |
| PARAGRAPH | WORD/PUNCT/NEWLINE/NEWLINE (block paragraph) |
The punctuation, whitespace, and newline characters are determined by your lexer settings and can be changed.
If the lexer cannot recognize the boundaries, no sentence or paragraph sections are indexed.
Syntax
CTX_DDL.ADD_SPECIAL_SECTION(
group_name IN VARCHAR2,
section_name IN VARCHAR2
);
group_name
Specify the name of the section group.
section_name
Specify SENTENCE or PARAGRAPH.
Example
The following example enables searching within sentences within HTML documents:
begin
ctx_ddl.create_section_group('htmgroup', 'HTML_SECTION_GROUP');
ctx_ddl.add_special_section('htmgroup', 'SENTENCE');
end;
Add zone sections to the group to enable zone searching in addition to sentence searching. The following example adds the zone section Headline to the section group htmgroup:
begin
ctx_ddl.create_section_group('htmgroup', 'HTML_SECTION_GROUP');
ctx_ddl.add_special_section('htmgroup', 'SENTENCE');
ctx_ddl.add_zone_section('htmgroup', 'Headline', 'H1');
end;
If you are only interested in sentence or paragraph searching within documents and not interested in defining zone or field sections, then use the NULL_SECTION_GROUP as follows:
begin
ctx_ddl.create_section_group('nullgroup', 'NULL_SECTION_GROUP');
ctx_ddl.add_special_section('nullgroup', 'SENTENCE');
end;
Related Topics
“WITHIN”