ColdFusion MX 7 can return more detailed information about each document returned by a user’s searches.
| Variable | Description |
|---|---|
| Author | The Verity derived author of this document |
| Category | A comma separated list of categories for this document, as specified on index |
| CategoryTree | The hierarchical category string for this document, as specified on index |
| Context | A context summary containing the search terms, highlighted in bold (by default) |
| Custom3,Custom4 | Two additional custom fields for application specific uses |
| Rank | The rank of this document in the search results |
| Size | The number of bytes in the index document |
| Type | The MIME type of the document indexed |
One of the more popular requests we received from ColdFusion developers using searching and indexing was that they wanted more (preferably unlimited!) custom fields. Well, we weren’t able to provide unlimited custom fields, but we added two more. Additionally, where possible, we passed along information (such as author) that was already contained in the index.
With the enhanced cfsearch tag, you can find out how many documents were searched, how many were found, and how long the search took. By setting the status attribute in the cfsearch tag, you can specify a variable name, in this case, info, that the tag uses to return information about the search.
<cfsearch status="info" collection="mycol" criteria="#Form.query#"> <cfoutput> Found: #info.FOUND# documents<br> Searched: #info.SEARCHED# documents<br> Search time: #info.TIME# milliseconds<br> </cfoutput>
| Variable | Description |
|---|---|
| Found | The number of documents that contain the search criteria |
| Searched | The number of documents searched. Corresponds to the "RecordsSearched" column in the search results |
| Time | The number of milliseconds the search took, as reported by the Verity K2 search service |
| SuggestedQuery | An alternate query, as suggested by Verity, that may produce better (more) results; often corrected spelling suggestions for search terms |
| Keywords | A structure that contains each search term as a key to an array of up to five possible alternative terms, in order of preference. Keyword is only present only when the suggestions tag attribute criteria is met in the cfsearch tag. |
| KeywordScore | A structure that mirrors the Keywords structure, and contains the Verity generated "score" of each of the alternate keywords, on a 0 to 99 point scale. |
Figure 1 shows a status structure, including suggestions for alternate search terms.
Figure 1. The status structure