Highlighting

To obtain highlighting information, specify the etx_GetHilite() function in the SELECT list of the query.

Specify the SELECT list as shown in the following example:
SELECT etx_GetHilite(abstract, rc) FROM reports
    WHERE etx_contains(abstract, 
    Row('multimedia editor', 'SEARCH_TYPE = PROX_SEARCH(5)'),
    rc # etx_ReturnType);

The example shows a proximity search, similar to the one in Perform text search queries. In addition to returning the document, the example also shows how to return highlighting information with the function etx_GetHilite(). The data type of the return value of the function is etx_HiliteType, a row data type derived by HCL OneDB™ that consists of two fields, vec_offset and viewer_doc, that contain highlighting information.

The vec_offset field contains offset information about every instance of the words multimedia and editor in the returned document, as long as the two words are within five words of each other. The viewer_doc field contains the text document itself.

You can use the etx_ViewHilite() routine together with the etx_GetHilite() routine to actually view the highlighted instances of multimedia and editor. The following complex query returns 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);

If you were to view the results of this query in a browser, the clues multimedia and editor would appear in boldface type.

For more detailed information about these highlighting routines, see Routines, which includes an example of using the etx_ViewHilite() routine with the etx_HiliteDoc() routine to highlight clues in an individual document.

You can also use standard routines, such as ifx_lo_open() and ifx_lo_read(), or DataBlade API large object routines, such as mi_lo_open() and mi_lo_read(), to manipulate etx_HiliteType objects.
Tip: You can use the NO_HILITE query parameter to speed up queries for which you want to return the score of the query results but you are not interested in highlighting the information. See The etx_contains() operator for more information about the NO_HILITE query parameter.