ColdFusion lets you enhance the results of searches by letting you incorporate search features that let users more easily find the information they need. The following search enhancements are available through Verity:
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:
| Attributes | Description |
|---|---|
|
ContextHighlightBegin |
Specifies the HTML tag to prepend 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. |
The following example adds to the previous search results example, highlighting the returned search terms with bold type.
<html> <head> <title>Search Results</title> </head> <body> <cfsearch name = "codecoll_results" collection = "CodeColl" criteria = "#Form.Criteria#"> ContextHighlightBegin="<b>" ContextHighlightEnd="</b>" ContextPassages="1" ContextBytes="500" maxrows = "100"> <h2>Search Results</h2> <cfoutput> Your search returned #codecoll_results.RecordCount# file(s). </cfoutput> <cfoutput query="codecoll_results"> <p> File: <a href="#URL#">#Key#</a><br> Document Title (if any): #Title#<br> Score: #Score#<br> Summary: #Summary#<br> Highlighted Summary: #context#</p> </cfoutput> </body> </html>
Note: This overwrites the previous ColdFusion example page.
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | KnowledgeBase | Bug Reporting
Version 7
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/7/htmldocs/00001309.htm
Comments
No screen name said on Jul 12, 2007 at 10:28 AM :