Listing 1: Verity_Build.cfm - Build and populate the Verity collection
<HTML>
<HEAD>
<TITLE>Verify Build</TITLE>

<BODY>

<CFCOLLECTION
ACTION="CREATE"
COLLECTION="HTMLGoodies"
PATH="C:\CFUSION\Verify\Collections\">

<CFINDEX COLLECTION="HTMLGoodies"
ACTION="REFRESH"
TYPE="PATH"
KEY="C:\SpiderData\HTMLGoodies"
RECURSE="YES"
URLPATH="http://"
EXTENSIONS=".htm,.html">

The collection has been created and populated.
</BODY>
</HTML>

Listing 2: Search.cfm - Search criterion form
<HTML>
<HEAD>
<TITLE>Web Spider</TITLE>
<DIV ALIGH="CENTER"><B>Web Spider</B></DIV><BR><BR>

<CFFORM ACTION="search_action.cfm" METHOD="POST">

Search Criterion:
<CFINPUT TYPE="TEXT"
NAME="Search"
REQUIRED="YES"
MESSAGE="Enter a search criterion.">

<INPUT TYPE="SUBMIT" VALUE="Submit"><BR>

Show Context and Summary?
<CFINPUT TYPE="CHECKBOX"
NAME="Context"
CHECKED="YES">
</CFFORM>

</BODY>
</HTML>

Listing 3: Search_Action.cfm - Display search results
Variables:
MaxLinks    = Number of links displayed
Form.Search     = Search criterion
Form.Context     = Option button to show context/summary
Search_Results    = CFSEARCH results .URL     = File system path with slashes reversed
and appended to URLPATH from CFINDEX
.Title     = Short title of the search result
.Summary     = Automatically generated summary
.Recordcount    = Number of records in the CFSEARCH
results
.Score    = Decimal relevancy score
PScore     = Percentage relevancy score
SearchWord     = First word in search criterion
Context     = Summary with highlighted keyword
<HTML>
<HEAD>
--->

<TITLE>Web Spider</TITLE>
</HEAD>
<BODY>

<CFSET MaxLinks = 10>
<!---Time CFSEARCH--->
<CFSET TickBegin = GETTICKCOUNT ()>
<CFSEARCH COLLECTION ="HTMLGoodies"
NAME="Search_Results"
CRITERIA="#FORM.Search#"
TYPE="SIMPLE">
<CFSET loopTime = GETTICKCOUNT () - TickBegin>

<DIV ALIGN="CENTER"><B>Web Spider</B><DIV><BR><BR>

<---Search results titlebar--->
<TABLE BORDER="0"
WIDTH="100%"
CELLPADDING="0"
CELLSPACING="0"
BGCOLOR="3366cc">
<TR>
<TD>
<FONT COLOR="WHITE">  Search results for
"<CFOUTPUT><B><I>#FORM.Search#</I></B></CFOUTPUT>"
</FONT>
</TD>
<TD ALIGN="right">
<FONT COLOR="WHITE"><CFOUTPUT>
Displaying top <B><I>#MaxLinks#</I></B> links.
Search time was <B>#LoopTime#</b> ms.   
</CFOUTPUT></FONT>
</TD>
</TR>
</TABLE>

<---Search results table--->

<TABLE BORDER="0" WIDTH="90%" ALIGN="CENTER">
<TR>
<TD><B>Titles</B></TD>
<TD><B>Score</B></TD>
</TR>
<!---Loop through search results --->
<CFOUTPUT QUERY="Search_Results" MAXROWS="#MaxLinks#">
<!---Change file paths to valid http URLs --->
<CFSET Link=
REPLACELIST(Search_Results".URL, "/index.htm", " ")>
<CFSET PScore = Search_Results.SCORE *100>
<TR>
<TD>
<A HREF="#Link#">#Search_Results.TITLE#
</TD>
<TD>#PScore#%</td>
</TR>
<TR>
<TD>
<!--- If the context option button is clicked then show context/summary --->
<CFIF ISDEFINED ("FORM.Context")>
<CFSET SearchWord = LISTFIRST (FORM.Search, ' ')>
<!--- Replace first word of search criterion with a highlighted version of itself --->
<CFSET Context =
REPLACENOCASE (Search_Results.SUMMARY,

"#SearchWord#", "<SPAN STYLE='background:FFFFOO' >
<B>#UCASE(SearchWord)#</B></SPAN>",'ALL')>
#Context#<br>
</CFIF>
<BR>
</TD>
</TR>
</CFOUTPUT>
</TABLE>

</BODY>
</HTML>