POLICY_TOKENS
##
Generate all index tokens for document. With this procedure, no CONTEXT index is required.
Syntax
ctx_doc.policy_tokens(policy_name in VARCHAR2,
document in [VARCHAR2|CLOB|BLOB|BFILE],
restab in out nocopy token_tab,
language in VARCHAR2 default NULL,
format in VARCHAR2 default NULL,
charset in VARCHAR2 default NULL,
thes_name in VARCHAR2 default NULL,
thes_toktype in VARCHAR2 default 'SYN');
policy_name
Specify the policy name created with CTX_DDL.CREATE_POLICY.
document
Specify the document for which to generate tokens.
restab
Specify the name of the token_tab PL/SQL index-by-table type.
The tokens returned are those tokens which are inserted into the index for the document. Stop words are not returned. Section tags are not returned because they are not text tokens.
See Also: “TOKENS” of this chapter for more information about the structure of the token_tab type
language
Specify the language of the document. Use an Oracle Text supported language value as you would in the language column of the base table. See “MULTI_LEXER” in Oracle Text Indexing Elements.
format
Specify the format of the document. Use an Oracle Text supported format value, either TEXT, BINARY or IGNORE as you would specify in the format column of the base table. For more information, see the format column description in “CREATE INDEX”.
charset
Specify the character set of the document. Use an Oracle Text supported value as you would specify in the charset column of the base table. See “Filter Types”.
thes_name
Specify the thesaurus name. If you do not specify a name, no synonyms or broader terms for index tokens will be generated.
To use the system default thesaurus, specify DEFAULT.
thes_toktype
Specify SYN to generate synonyms. Alternatively, specify BT to generate broader terms of index tokens. By default, only synonyms are generated. To use this parameter, you must first specify the thesaurus name using the thes_name parameter.
Example 1
Get tokens:
declare
la varchar2(200);
rtab ctx_doc.token_tab;
begin
ctx_doc.policy_tokens('mypolicy',
'To define true madness, What is''t but to be nothing but mad?',rtab);
for i in 1..rtab.count loop
dbms_output.put_line(rtab(i).offset||':'||rtab(i).token);
end loop;
end;
Example 2
This example uses thesaurus support to generate synonyms for tokens:
declare
rtab ctx_doc.token_tab;
begin
ctx_doc.policy_tokens('mypolicy','the lazy dog',rtab,thes_name =>'animals');
for i in 1..rtab.count loop
dbms_output.put_line(rtab(i).token||'a'||rtab(i).thes_tokens);
end loop;
end;