Use a SearchReportJob to generate a search report from some or all of the items listed in a SearchResults object.
File: SearchReportJob.java
Package: com.dtsearch.engine
Method |
Description |
---|---|
Free memory allocated for objects such as SearchResults. | |
Select no items from the SearchResults list | |
Generate the search report. | |
A JobErrorInfo containing information about any errors that occurred during generation of the search report. | |
Result of the search report, if OutputToString was set to true | |
Select all items in the SearchResults list | |
Select a range of items from the SearchResults list | |
Text to insert after each hit. | |
Text to insert before each hit. | |
Text to appear after each block of context. | |
Text to appear in front of each block of context. | |
Text to appear between each block of context. | |
Use setDocBytes to provide a document in a memory buffer rather than as a disk file. The byte array input must contain exactly the same bytes as the representation of this document on disk. When a byte array is provided through setDocBytes, the filename is disregarded. setDocBytes can only be used when exactly one document is selected to be included in the report. | |
Text to appear after each file in the search report. | |
Text to appear in front of each file in the search report. | |
SearchReportFlags specifying how the report should be generated | |
Footer of the search report | |
Header of the search report | |
Number of blocks of context to include in the report. If zero, all hits in each document will be included. | |
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. This setting can be used to generate faster (but not necessarily complete) reports by limiting the search report to hits near the beginning of each document. | |
The name of the file to create. | |
The file format of the output. By default, the output format is HTML. To request an plain text report, set OutputFormat to it_Ansi. To request an RTF report, set OutputFormat to it_RTF. | |
When output is directed to an in-memory string, you may wish to limit the maximum amount of memory used. To do this, set OutputStringMaxSize to the maximum size you want to allow. Note: The dtSearch Engine will not preallocate this amount of memory. Instead, it will allocate a small amount of memory and grow the string as needed, either until the job is complete or the size limit is reached. | |
If true, output will be stored in an in-memory string variable rather than a disk file. (OutputFile will be ignored.) After the execute method is done, the output will be in the OutputString property. | |
Number of paragraphs of context to include around each hit. | |
The search results list that this SearchReportJob will use. The SearchResults will be attached automatically if you used its NewSearchReportJob method to create this job. | |
Set to a non-zero value if you want the job to terminate automatically after a specified number of seconds. | |
Number of words of context to include around each hit. Use setWordsOfContextExact to get exactly the requested number of words, and use setWordsOfContext to get whole paragraphs with at least the requested number of words | |
Number of words of context to include around each hit. Use setWordsOfContextExact to get exactly the requested number of words, and use setWordsOfContext to get whole paragraphs with at least the requested number of words |
To create a SearchReportJob,
1. Call the SearchResults object's newSearchReportJob method to create a SearchReportJob.
2. Set up the properties of the SearchReportJob to reflect the format of the report you want to create.
3. Call selectAll() or selectItems() to select the items to include in the report.
4. Call execute() to generate the report.
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:
The report as a whole is constructed as follows:
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 |
SizeK |
File size in kilobytes |
Date |
Modification date of the file when indexed |
Hits |
Number of hits in the file |
Title |
The first 80 characters of the file |
The docId of the file | |
Type |
The file type (Microsoft Word, PDF, HTML, etc.) |
Ordinal |
The 1-based ordinal of this item in the SearchResults from which it was generated |
IndexRetrievedFrom |
The index where the file was found |
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. |