Oracle8i interMedia Text Reference Release 2 (8.1.6) Part Number A77063-01 |
|
CTX_DOC Package , 4 of 8
Use the CTX_DOC.HIGHLIGHT procedure to generate highlight offsets for a document. The offset information is generated for the terms in the document that satisfy the query you specify. These highlighted terms are either the words that satisfy a word query or the themes that satisfy an ABOUT query.
You can generate highlight offsets for either plaintext or HTML versions of the document. Yo can apply the offset information to the same documents filtered with CTX_DOC.FILTER.
You usually call this procedure after a query, from which you identify the document to be processed.
You can store the highlight offsets in either an in-memory PL/SQL table or a result table.
CTX_DOC.HIGHLIGHT( index_name IN VARCHAR2, textkey IN VARCHAR2, text_query IN VARCHAR2 DEFAULT NULL, restab IN OUT HIGHLIGHT_TAB, query_id IN NUMBER DEFAULT 0, plaintext IN BOOLEAN DEFAULT FALSE);
CTX_DOC.HIGHLIGHT( index_name IN VARCHAR2, textkey IN VARCHAR2, text_query IN VARCHAR2 DEFAULT NULL, restab IN VARCHAR2 DEFAULT NULL, query_id IN NUMBER DEFAULT 0, plaintext IN BOOLEAN DEFAULT FALSE);
Specify the name of the index associated with the text column containing the document identified by textkey.
Specify the unique identifier (usually the primary key) for the document.
The textkey parameter can be one of the following:
You toggle between primary key and rowid identification using CTX_DOC.SET_KEY_TYPE.
Specify the original query expression used to retrieve the document. If NULL, no highlights are generated.
You can specify that this procedure store highlight offsets to either a table or to an in-memory PL/SQL table.
To store results to a table specify the name of the table.
See Also:
For more information about the structure of the highlight result table, see "Highlight Table" in Appendix B. |
To store results to an in-memory table, specify the name of the in-memory table of type CTX_DOC.HIGHLIGHT_TAB. The HIGHLIGHT_TAB datatype is defined as follows:
type highlight_rec is record ( offset number; length number; ); type highlight_tab is table of highlight_rec index by binary_integer;
CTX_DOC.HIGHLIGHT clears HIGHLIGHT_TAB before the operation.
Specify the identifier used to identify the row inserted into restab.
Specify TRUE to generate a plaintext offsets of the document.
Specify FALSE to generate HTML offsets of the document if you are using the INSO filter or indexing HTML documents.
Create the highlight table to store the highlight offset information:
create table hightab(query_id number, offset number, length number);
To obtain HTML highlight offset information for document 20 for the word dog:
begin ctx_doc.highlight('newsindex', '20', 'dog', 'hightab', 0, FALSE); end;
Assuming the index newsindex has a theme component, you obtain HTML highlight offset information for the theme query of politics by issuing the following query:
begin ctx_doc.highlight('newsindex', '20', 'about(politics)', 'hightab', 0, FALSE); end;
The output for this statement are the offsets to highlighted words and phrases that represent the theme of politics in the document.
Before CTX_DOC.HIGHLIGHT is called, the result table specified in restab must exist.
When textkey is a composite textkey, you must encode the composite textkey string using the CTX_DOC.PKENCODE procedure.
If text_query includes wildcards, stemming, fuzzy matching which result in stopwords being returned, HIGHLIGHT does not highlight the stopwords.
If text_query contains the threshold operator, the operator is ignored. The HIGHLIGHT procedure always returns highlight information for the entire result set.
When query_id is not specified or set to NULL, it defaults to 0. You must manually truncate the table specified in restab.
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|