User Guide

Table Of Contents
570 Chapter 24: Building a Search Interface
<cfoutput>
<p>Number of records in query: #sr.recordcount#</P>
</cfoutput>
<cfdump var="#sr#">
<cfoutput Query="sr">
Title: <i>#title#</i><br>
URL: #url#<br>
Score: #score#<br>
<hr>
#context#<br>
<br>
#summary#<br>
<hr>
</cfoutput>
</cfif>
For more information on using the cfindex tag to create Verity collections with support for
categories, see
cfsearch in Chapter 2, “ColdFusion Tags,” in CFML Reference.
Retrieving information about the categories contained in a collection
You can retrieve the category information for a collection by using the
cfcollection tags
categoryList action. The categoryList action returns a structure that contains two keys:
You can use the information returned by
categoryList to display to users the number of
documents available for searching, as well the document tree available for searching. You can also
create a search interface that lets the user select what category to search within based on the results
returned by
categoryList.
<cfcollection
action="categoryList"
collection="collectionName"
"name="info">
<cfoutput>
<cfset catStruct=info.categories>
<cfset catList=StructKeyList(catStruct)>
<cfloop list="catList" index="cat"> Category: #cat# <br>
Documents: #catStruct[cat]#<br>
</cfloop>
</cfoutput>
Variable Description
categories The name of the category and its hit count, where hit count is the number of
documents in the specified category.
categorytrees The document tree (a/b/c) and hit count, where hit count is the number of
documents at or below the branch of the document tree.