The etx_ViewHilite() routine

The etx_ViewHilite() routine highlights the data returned by the etx_GetHilite() or etx_HiliteDoc() routines.

Syntax

etx_ViewHilite (hilite_type, hilite_prefix, hilite_suffix)
Element Purpose Data type
hilite_type The etx_HiliteType data returned by the etx_GetHilite() or etx_HiliteDoc() routines. Etx_HiliteType
hilite_prefix The text you want to appear before the highlight string. LVARCHAR
hilite_suffix The text you want to appear after the highlight string. LVARCHAR

Return type

The etx_ViewHilite() routine returns an LVARCHAR value that contains the text of selected documents, with every instance of the search text surrounded by specified highlight tags.

Usage

The etx_ViewHilite() routine manipulates the vec_offset and viewer_doc data returned by the etx_GetHilite() or etx_HiliteDoc() routines.

Control the Size of Highlighted Documents with the ETX_HILITE_MAXLEN Environment Variable

The default size of the return value of the etx_ViewHilite() routine is 32 767 bytes. To override this default value so that the etx_ViewHilite() routine can return larger highlighted documents, set the ETX_HILITE_MAXLEN environment variable to a higher value. For example:
export ETX_HILITE_MAXLEN 100000

Make sure that you also allow for the highlighting characters in the returned documents by setting ETX_HILITE_MAXLEN to a higher value than the size of the largest document in the index.

Large values of ETX_HILITE_MAXLEN can cause highlighting queries to use more memory. When you set the ETX_HILITE_MAXLEN environment variable, the allocates the difference between the default value of 32 767 bytes and the value ETX_HILITE_MAXLEN for memory for the returned highlighted documents.

Examples

The following SQL statement uses the etx_GetHilite() and etx_ViewHilite() routines to retrieve the text of relevant documents with every instance of the words multimedia and editor surrounded by the HTML tags <b> and </b>:
SELECT etx_ViewHilite (etx_GetHilite(abstract, rc), '<b>', '</b>')
FROM reports
WHERE etx_contains (abstract, 'multimedia editor', rc # etx_ReturnType);
The following example uses etx_HiliteDoc() and etx_ViewHilite() routines to retrieve the text of the document with ID 1 with every instance of the word multimedia surrounded by the HTML tags <b> and </b>:
SELECT etx_ViewHilite(etx_HiliteDoc(description, 'desc_idx1',
                      Row('multimedia', 'SEARCH_TYPE=PHRASE_APPROX')),
                      '<b>','</b>')
    FROM videos
    WHERE id = 1;