
490
DEVELOPING
COLDFUSION 9 APPLICATIONS
Accessing and Using Data
Las
t
upda
te
d 8/5/2010
4
Enter target words and click Search.
Note:
As part of the indexing process, Verity automatically produces a summary of every document file or every query
recordset that gets indexed. The default summary result set column selects the best sentences, based on internal rules, up
to a maximum of 500 characters. Every
cfsearch
operation returns summary information by default. For more
information, see “
Using Verity Search Expressions
” on page
505. Alternatively, you can use the context result set column,
which provides a context summary with highlighted search terms.
Enhancing search results
ColdFusion lets you enhance the results of searches by letting you incorporate search features that let users more easily
find the information they need. Verity provides the following search enhancements:
•
Highlighting search terms
•
Providing alternative spelling suggestions
•
Narrowing searches using categories
Highlighting search terms
Term highlighting lets users quickly scan retrieved documents to determine whether they contain the desired
information. This can be especially useful when searching lengthy documents, letting users quickly locate relevant
information returned by the search.
To implement term highlighting, use the following cfsearch attributes in the search results page:
The following example adds to the previous search results example by highlighting the returned search terms with bold
type.
Create a search results page that includes term highlighting
1
Create a ColdFusion page with the following content:
Attributes
Description
ContextHighlightBegin
Specifies the HTML tag to prefix to the search term within the returned documents. This attribute
must be used in conjunction with ContextHighlightEnd to highlight the resulting search terms. The
default HTML tag is
<b>
, which highlights search terms using bold type.
ContextHighlightEnd
Specifies the HTML tag to append to the search term within the returned documents.
ContextPassages
The number of passages/sentences Verity returns in the context summary (the context column of
the results). The default value is 0; this disables the context summary.
ContextBytes
The total number of bytes that Verity returns in the context summary. The default is 300 bytes.