You are here: C++ API > File Parser API > Output Formats
Close
dtSearch Text Retrieval Engine Programmer's Reference
Output Formats

File parsers can return text in RTF or UTF8.

A file parser can return data in formats other than plain text, and a file parser that returns the requested format will have precedence over a file parser that returns a different format. 

To indicate the file formats your parser can return, set one or more of the following flags in dtsViewerInfo.flags: viReturnsRtf, or viUtf8CharSet. When your parser's makeViewer function is called, the dtsMakeViewerParams struct will indicate the requested output format in dtsMakeViewerParams.outputFormat. 

If your file parser receives a file format in dtsMakeViewerParams.outputFormat that it cannot generate, makeViewer2 should return NULL so another file parser can be invoked to process the file. 

To ensure that hit highlighting is consistent, the text and word breaks must be identical regardless of the format returned.

RTF Output Format

RTF returned from a file parser can contain the following tags: 

\u, \line, \par, \b, \i, \dtSearchField 

Other tags will be ignored. Characters with codes higher than 128 (i.e., any Unicode characters) must be returned using the \u syntax.

Returning fields from a file parser - RTF

A file parser that returns RTF can return fielded data by using the \dtSearchField tag, like this:

{\dtSearchField fieldname}

If the field is nested, the fully qualified field name must be provided, as follows:

{\dtSearchField record/patient/name }

A field automatically terminates the previous field. For example:

{\dtSearchField record/patient }{\dtSearchField name } john smith

In the above example, john smith is part of a field named name. The record/patient field ends when the name field begins. To indicate the end of a field, use a blank field name, like this:

{\dtSearchField }
Copyright (c) 1995-2021 dtSearch Corp. All rights reserved.