Links
dtSearch Text Retrieval Engine Programmer's Reference 7.70
DSearchReportJob Class
Data Members | Classes | Legend | Members | Methods | DSearchReportJob Constructor | Example | Send Feedback

Describes a search report to be prepared from some or all of the items in a DSearchResults set.

Class Hierarchy
class DSearchReportJob : public DOutputBase;
File

dtsfc.h

Remarks

To generate a search report, 

(1) Start with a dtsSearchResults object representing the results of a search. 

(2) Declare a DSearchReportJob, passing the dtsSearchResults to the constructor 

(3) Select the items to include in the search report using the Select*() methods in DSearchReportJob 

(4) Specify the amount of context to include using SetContextWords() or SetContextParagraphs() 

(5) Set the output format for the report 

(6) Call Execute() to generate the report

Format

A search report lists the hits found in one or more documents, with each hit surrounded by a specified amount of context. Each block of context starts with a contextHeader and ends with the contextFooter. Contiguous or overlapping blocks of context will be combined. The amount of context included in the report can be specified by words or by paragraphs. 

Each block of context is constructed as follows:

    [ContextHeader]
    ...text... [BeforeHit] hit [AfterHit] ...text...
    [ContextFooter]

 

The report as a whole is constructed as follows:

    [Header]
        [FileHeader]
            [ContextHeader]
            ...text... [BeforeHit] hit [AfterHit] ...text...
            [ContextFooter]
            [ContextHeader]
            ...text... [BeforeHit] hit [AfterHit] ...text...
            [ContextFooter]
            ... more blocks of context, if present
        [FileFooter]
        ... more files ...
    [Footer]

 

Use the following symbols to insert file information into the FileHeader and FileFooter:

Symbol 
Meaning 
Filename 
The name of the file (without path information). For PDF and HTML files, this will be the Title. 
Location 
The location of the file 
Fullname 
The path and filename of the file. 
Size 
File size in bytes 
Date 
Modification date of the file when indexed 
Hits 
Number of hits in the file 
Title 
The first 80 characters of the file 

Use %% around each symbol, like this: %%FullName%% 

Use the following symbols to insert context information in the contextHeader, which appears in front of each block of context:

Symbol 
Meaning 
Page 
Page number where the hit occurs 
Paragraph 
Paragraph number where the hit occurs (relative to the start of the page) 
Word 
Word offset of the block of context from the beginning of the file. 
FirstHit 
Word offset of the first hit in the block of context. 
Example
// Assume m_pResults is a pointer to dtsSearchResults
DSearchReportJob reportJob(*m_pResults);
// Request exactly 10 words of context around each hit
reportJob.SetContextWords(10, true);
// Specify which items in search results to include
reportJob.SelectRange(firstItemToInclude, lastItemToInclude);
// Highlight hits in bold, with a line between each block of context
reportJob.SetOutputFormat(it_Html);
reportJob.BeforeHit.setU8("<b>");
reportJob.AfterHit.setU8("</b>");
reportJob.ContextHeader = "<hr>";
// Generate output to a string limited to 512 bytes
reportJob.SetOutputToString(512);
// Request at most two blocks of context for each document included in the report
reportJob.SetMaxContextBlocks(2);
// Use cached text in the index, if present
reportJob.SetFlag(dtsReportGetFromCache);
// Generate the report
reportJob.Execute();
Data Members
DOutputBase Class
Data Member 
Description 
Text inserted after each hit 
Text inserted before each hit 
Text inserted at the end of the file 
Text inserted at the start of the file 
For HTML output, an HREF for a BASE tag to be inserted in the header. 
For HTML output, HTML tags to insert in the header 
Name of file to create, if the output is to be written to a file. 
DSearchReportJob Class
Data Member 
Description 
Text to appear after each block of context 
Text to appear in front of each block of context. 
Text to appear between blocks of context (after the ContextFooter
Text to appear after each file in the search report 
Text to appear after each file in the search report 
Group
Methods
Method 
Description 
Requests termination of the job in progress. 
Requests immediate termination of the job in progress. 
Called to execute a job. 
Returns non-zero if the job failed 
Format all errors that occurred during execution as a single string, with line breaks separating the errors 
Returns the number of errors recorded during execution 
Returns a dtsErrorInfo with any errors that occurred during execution 
Returns true if the job has been cancelled 
Returns true if the job has started and is not yet done. 
Called while a job is executing every time the dtSearch Engine checks to see if the job has been cancelled. 
Called while a job is executing if an error is encountered, with the error code and message. 
Not used 
SetTimeout() causes a job to cancel automatically after the specified number of seconds 
Do not pump waiting windows messages during callbacks 
DOutputBase Class
Method 
Description 
Clear all fields to default values 
Called to execute a job. 
If output was to a string, returns a pointer to the output string 
Get the length of the output string 
Returns true if output was directed to a string 
Called while a job is executing every time the dtSearch Engine checks to see if the job has been cancelled. 
 
Callback function to receive output as it is generated 
Callback function to update the progress of the conversion or search report 
Specifies the format of the converted text. 
Send output only to the virtual callback function, OnOutput 
Send output to a file 
Send output to a string buffer managed by the class, and set the maximum length of the output string. 
DSearchReportJob Class
Method 
Description 
Attach search results to the DSearchReportJob. 
Clear all selections previously made using SelectAll or SelectRange 
This is the overview for the DSearchReportJob constructor overload. 
Generate the report 
Get ReportFlags for this report 
Select all items in the SearchResults
Select a range of items in the SearchResults 
Set the amount of context around each hit as a number of paragraphs 
Include the whole file for each item in search results 
Set the number of words of context around each hit, and specify whether the exact number of words should be collected. 
! Internal use only 
Set ReportFlags for this report 
Number of blocks of context to include in the report for each document. 
Number of words to scan in each document looking for blocks of context to include in the report For example, if maxWordsToRead=5000, then the search report will only include hits that occur in the first 5000 words in each document. 
Attach search results to the DSearchReportJob, making a private internal copy of the search results. 
Legend
 
Method 
 
virtual 
 
abstract 
 
Data Member 
Links
You are here: C++ Support Classes > dtSearch Namespace > Classes > DSearchReportJob Class
Copyright (c) 1995-2012 dtSearch Corp. All rights reserved.