How to add fields to search reports

Last Reviewed: August 6, 2013

Article: DTS0202

     

Applies to: dtSearch Desktop 6, 7

dtSearch Desktop can generate a report listing each hit found in each document, or just listing the documents retrieved.  To generate this list, click Search > Search Report in dtSearch Desktop.

Templates

The templates used to generate these reports are RTF files, which you can edit in Microsoft Word to change the layout of the report or to add additional fields.  The template files are installed to:

C:\Program Files\dtSearch\template\SearchReportTemplate.rtf (the report format showing hits in context)

C:\Program Files\dtSearch\template\SearchListTemplate.rtf (the report format showing a simple list of files)

To create a custom template, edit one of these files and save the edited template in your dtSearch UserData folder.

Template file format

The template files use symbols like %%Filename%% to represent information about each document.  For example, the list template looks like this:

Search Request: %%Request%%
                  Total files: %%TotalFiles%%
                  Total hits: %%TotalHits%%
<<<ListItem

%%Filename%% (%%Hits%% hits)

Location: %%Location%%  Size: %%Size%% Last modified: %%Date%%

>>> 

Text between the << >> markers defines the template for each search results item.   Text before the first <<< marker is the header.  Text after the >>> marker is ignored.  The sections in the template are:

ListItem

Template for a single item in the list format

FileHeader

Template for the file header in the report format

ContextHeader

Template for the header in front of each block of context in the report format

 

Symbols that can be included in the templates are:

 

Symbol

Meaning

%%Hits%%

Number of hits in the document

%%Filename%%

Name of the document. For PDF and HTML files, this will be the TITLE.

%%Fullname%%

Full path and filename of the document

%%Date%%

Modification date of the document

%%Location%%

Location of the document

%%Type%%

The file type (Microsoft Word, PDF, HTML, etc.

%%Size%%

Size of the document

%%SizeK%%

Size of the document in kilobytes

%%Title%%

First 80 text characters of the document

%%Ordinal%%

The number of this item in the search results list

%%IndexRetrievedFrom%%

The path of the index that this document was found in

%%SearchDate%%

The date the search was performed

%%ReportDate%%

The date the search report was generated

%%Request%%

Search request

%%TotalFiles%%

Number of files retrieved in the search

%%TotalHits%%

Number of hits in all files retrieved in the search

Adding custom fields

To add custom fields to a search report,

(1) Index the documents with the fields listed as "stored" fields.   For information on how to do this, see:  "How to get field data in search results"

(2) Add a symbol for the stored field to the search report template, by putting %% marks around the name of the field.  For example, to insert the Sender, Recipient, and Subject fields from email messages, add this to the template:

Subject:    %%Subject%%

Sender:     %%Sender%%
Recipient:  %%Recipient%%

For a list of the fields that dtSearch automatically detects in documents, see "What file formats does dtSearch support?"

Related Articles

How to add custom fields to dtSearch Web search results

How to get field data in search results

How to change the way dtSearch prints search results