How to customize the Verity Summary Result
Issue
This TechNote explains how to customize the summary result variable when using the cfsearch tag to return results from a Verity collection in Macromedia ColdFusion Server.
The cfsearch tag summary result variable returns the contents of the automatic summary generated by thecfindex tag. The default summary selects the best three matching sentences, up to a maximum of 500 characters. This TechNote describes how to modify the default summary result variable to return the first four sentences of the indexed document (but not more than 500 bytes) or the first 150 bytes of the indexed document.
You can modify the Verity style file, named style.prm, to use one of three summary result styles as the standard summary content. You can find the file in the following locations:
On Windows:
C:\CFusion\Verity\Common\style\style.prm
On Unix/Linux:
/opt/coldfusion/verity/common/style/style.prm
You can find the summary configuration at the end of the style.prm file. By default, it is configured as follows:
# --------------------------------------------------- # Document Summarization is enabled by uncommenting # one of the DOC-SUMMARIES lines below. The # summarization data is stored in the documents # table so that it might easily be shown when # displaying the results of a search. See the # discussions on Document Summarization in the # Collection Building Guide for more information. # The example below stores the best three sentences # of the document, but not more than 500 bytes. $define DOC-SUMMARIES "XS MaxSents 3 MaxBytes 500" # The example below stores the first four sentences # of the document, but not more than 500 bytes. #$Define DOC-SUMMARIES "LS MaxSents 4 MaxBytes 500" # The example below stores the first 150 bytes of # the document, with whitespace compressed. #$Define DOC-SUMMARIES "LB MaxBytes 150" # ---------------------------------------------------
Note that the line without a comment (without a single pound sign #) determines the format of the summary result variable. By default, the summary result variable is set to use "$define DOC-SUMMARIES "XS MaxSents 3 MaxBytes 500" which means it will return the "best three sentences of the document, but not more than 500 bytes." Before each summary choice is a two-line description of the configuration. The description should always remain commented out (with a single pound sign # to the left of it).
Solution
In the following example, we will modify the modify the generated summary to be "the first 150 bytes of the document, with whitespace compressed" option.
- Modify the end of the style.prm file. Disable the current choice by placing a pound sign (#) to the left of the option you are disabling. Enable the other choice by deleting the pound sign (#) to the left "$define DOC-SUMMARIES "LB MaxBytes 150," as follows:
# --------------------------------------------------- # Document Summarization is enabled by uncommenting # one of the DOC-SUMMARIES lines below. The # summarization data is stored in the documents # table so that it might easily be shown when # displaying the results of a search. See the # discussions onDocument Summarization in the # Collection Building Guide for more information. # The example below stores the best three sentences # of the document, but not more than 500 bytes. #$Define DOC-SUMMARIES "XS MaxSents 3 MaxBytes 500" # The example below stores the first four sentences # of the document, but not more than 500 bytes. #$Define DOC-SUMMARIES "LS MaxSents 4 MaxBytes 500" # The example below stores the first 150 bytes of # the document, with whitespace compressed. $Define DOC-SUMMARIES "LB MaxBytes 150" # ---------------------------------------------------
Important note: Within this file, make sure that only one of the three choices is without a comment (without a pound sign #). Removing a comment enables your configuration choice. The two-line description should always remain commented out (a single pound sign #). - Purge and rebuild your Verity collections to generate new summaries for your existing Verity collections.
For more information on the cfsearch tag and thesummary result variable, please refer to your ColdFusion Server manuals, or use the cfsearch tag documentation in the Macromedia LiveDocs area.
This content requires Flash
To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.
Download the free Flash Player now!
