Highlighting
To obtain highlighting information, specify the etx_GetHilite() function in the SELECT list of the query.
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.
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.