|
dtSearch Support |
Last Reviewed: November 2, 2006
Article: DTS0194
Applies to: dtSearch Engine 6.5 and later
SearchReportJob
The SearchReportJob object in the dtSearch Engine API provides a way to extract a few words of context around each hit. For example, see:
http://support.dtsearch.com/Support/demos/forms/SimpleSearch/dtsearch.html
For more information on the SearchReportJob object, see:
SearchReportJob (.NET)
SearchReportJob (VB/COM/ASP)
SearchReportJob (Java)
DSearchReportJob (C++)
Generation of a synopsis is much faster if you use the version 7 index format with caching of text enabled, because the context can be extracted from the index without the need to access the original files. Caching text is also helpful when the page may not be accessible to the dtSearch Engine when the search report is generated. This article explains how to enable caching using dtSearch Desktop:
http://support.dtsearch.com/webhelp/dtsearch/caching.htm
This article explains how to use caching in the dtSearch Engine's developer API:
Additional technical information on the version 7 index format is here:
Version 7 Index Format
http://www.dtsearch.com/index7.html
Use the following settings in SearchReportJob to generate a brief hits-in-context string to show in search results:
1. Use MaxContextBlocks to limit the number of blocks of context included in the report. For example, if MaxContextBlocks = 1, then only the first hit will be included.
2. Use WordsOfContextExact instead of WordsOfContext -- otherwise SearchReportJob will return whole paragraph-sized blocks.
3. Set the OutputFormat to itUnformattedHTML, so output characters will be correctly HTML-encoded and so formatting from the original document will not appear in the search results list. (If you use itHTML as the output format, the output could contain paragraph breaks, color changes, etc., that would not look right in a search results table.)
4. Set the dtsReportStoreInResults flag in SearchReportJob, which causes the synopsis to be stored in each search results item, making it easier to access the individual synopsis items.
5. Set the BeforeHit and AfterHit marks to HTML tags like <b> and </b> to mark the hits.
6. Select a range of items to include in the search report that corresponds to the range items to be displayed. For example, if you are displaying the first ten items, select items 0 through 9.
After the search report has been generated, for each item in search results, there will be an HTML string containing the extracted synopsis.
To access the synopsis in each item in search results:
C/C++: Use
dtsSearchResultsItem.synopsis
.NET: Use
SearchResultsItem.Synopsis
VB/ASP: Use SearchResults.DocDetailItem("_synopsis")
Java: Use
SearchResults.getDocDetailItem("_synopsis")
For sample code demonstrating how to generate and display a synopsis in search results, see the sample applications in C:\Program Files\dtSearch Developer\examples\asp.net (.NET 1.1) and C:\Program Files\dtSearch Developer\examples\asp.net2 (.NET 2.0)