LISTING 1: Adding a Common Table to the Verity Search Engine
<cfset URLList="county_resources.cfm, list2.cfm, list.cfm, news.cfm,
index.cfm">
<cfset Custom1List="Y,Y,Y,N,N">
<cfset TheCounter=0>
<cfloop index="ii" list="resources,PUBLICATIONS,NEWSLETTER,News and
Events,Main Article">
<cfset TheCounter=TheCounter+1>
<cfset AddCustom1=ListGetAt(Custom1List,TheCounter)>
<cfset TheURL=ListGetAt(URLList,TheCounter)>
<cfoutput>
<cfif AddCustom1 IS "Y">
<cfset TheTitle="PUT-CUSTOM2-HERE|#TRIM(TheURL)#?itemtext=#TRIM
(ii)#&freeform2=PUT-CUSTOM1-HERE">
<cfelse>
<cfset TheTitle="PUT-CUSTOM2-HERE|#TRIM(TheURL)#?itemtext=#TRIM(ii)#">
</cfif>
</cfoutput>
<cfquery name="searchresults" datasource="datasourcename"
username="abc" password="123">
SELECT itemid, freeform2, itemtitle, itemdesc, itemtext1, itemtext2, freeform1
FROM tblFSN_dynamic_new
WHERE itemtext1='#TRIM(ii)#'
AND active='Y'
AND (getdate() BETWEEN startshowing and stopshowing
OR startshowing IS NULL OR stopshowing IS NULL)
ORDER BY freeform2
</cfquery>
<CFINDEX collection="FSN" action="UPDATE" type="CUSTOM" key="ITEMID"
title="#TheTitle#"
body="itemtitle,itemdesc,freeform2,itemtext1,itemtext2,freeform1"
custom1="freeform2" custom2="itemtitle" language="English" query="searchresults" external=NO>
<cfoutput>
<br>Found #searchresults.recordcount# records for #TRIM(ii)# - #TRIM(TheTitle)# *
</cfoutput>
</cfloop>
LISTING 2: SEARCH_RESULTS.CFM
<cfparam name="TheSearchPhrase" default="abuse">
<cfparam name="FORM.startrow" default=1>
<cfset TheReplaceList="<,>,##">
<cfset TheSearchPhrase=REPLACELIST(FORM.searchphrase,TheReplaceList,"")>
<cfset TheSearchPhrase=REPLACE(TheSearchPhrase,"""","'","ALL")>
<cfif LEN(TRIM(TheSearchPhrase)) LT 1><cflocation url="index.cfm"></cfif>
<html>
<head><title>PCAMN - Index</title></head>
<cfinclude template="header.cfm">
<br>
<h3>Search Results</h3>
<CFSEARCH name = "GetResults" collection = "PCAMN" criteria = "#TRIM(TheSearchPhrase)#"
maxRows = "100" external = "No" startRow = "#FORM.startrow#">
<TABLE cellSpacing="0" cellPadding="1" width="500" border="0">
<TBODY><TR><TD width="100%">
<CFIF GetResults.RecordCount LT 1>
<br><br>
<B>Nothing found for "<cfoutput>#TRIM(TheSearchPhrase)#</cfoutput>".
<br><br>
Please try again with a different search phrase.</B>
<br><br>
<CFELSE>
<TABLE cellspacing=0 cellpadding=6 width="100%" border="0">
<!--- table header --->
<TR bgcolor="cccccc">
<TD><B>Title</B>
<cfoutput><font size="-1"><em>#GetResults.recordcount# find(s) made on
"#TRIM(TheSearchPhrase)#"</em></font></cfoutput>
</TD>
<TD align="right"><B>Score </B></TD>
</TR>
CFOUTPUT query="GetResults" maxRows="100">
<TR bgcolor="#IIf(CurrentRow Mod 2, DE('FFFFFF'), DE('E8E8E8'))#">
<!--- title for HTML files --->
<TD>
<CFSET href = Replace(URL, " ", "%20", "ALL")>
<cfif LEN(TRIM(title)) LT 1>
<cfset TheTitle="Click Here">
<cfelse>
<cfset TheTitle=REPLACE(ListFirst(Title,"|"),"PUT-CUSTOM2-HERE",custom2)>
<cfif ListLen(title,"|") GT 1>
<cfset href=REPLACE(ReplaceNoCase(href & "/" &
ListRest(Title,"|"),"//","/","all"),"PUT-CUSTOM1-HERE",custom1)>
</cfif>
</cfif>
<cfif LEN(TRIM(custom2)) GT 0><cfset TheTitle=UCASE(TRIM(custom2))></cfif>
<cfset Newhref=REPLACE(href,"?","&","ALL")>
<A href="showme.cfm?sp=#TheSearchPhrase#&page=#Newhref#"
class="mcpilink" style="font-face: Tahoma; font-size: 14;"> #REPLA
CENOCASE(TheTitle,TRIM(TheSearchPhrase),'<font style="background-color:
yellow;"> #UCASE(TRIM(TheSearchPhrase))#</font>',"all")# </A>
</TD>
<!--- score --->
<TD align="right" id="st5" style="font-size: 11;">
<cfif ISNUMERIC(TRIM(score)) AND score GT
0>#NumberFormat(Score*100,"999.99")#%</cfif>
</TD>
</TR>
<TR bgcolor="#IIf(CurrentRow Mod 2, DE('FFFFFF'), DE('E8E8E8'))#">
<!--- title for HTML files --->
<TD colspan="2" style="font-face: Tahoma; font-size: 12;">
<cfset TheSummary=REPLACELIST(summary,TheReplaceList,"")>
<cfset TheSummary=REPLACE(TheSummary,"""","'","ALL")>
<cfset TheSummary=REPLACENOCASE(TheSummary,TheSearchPhrase,'<font
style="background-color: yellow;">#UCASE(TRIM(TheSearchPhrase))
#</font>',"ALL")>
#TheSummary#
</TD>
</TR>
</CFOUTPUT>
</TABLE>
<!--- CFSEARCH tried to retrieve one more file than the number specified
in the Form.MaxRows parameter. If number of retrieved files is greater
than MaxRows we know that there is at least one file left. The following
form contains only one button which reloads this template with the new
StartRow parameter. --->
<CFIF GetResults.RecordCount gt 100>
<FORM action="search_results.cfm" method="post">
<CFOUTPUT>
<INPUT type="hidden" name="searchphrase"
value="#TheSearchPhrase#">
<INPUT type="hidden" name="StartRow"
value="#Evaluate(Form.StartRow + 100)#">
<INPUT type="submit" value=" More ... ">
</CFOUTPUT>
</FORM>
</CFIF>
</CFIF>
</TD></TR></TBODY>
</TABLE>
<br clear="all"><br>
<cfinclude template="footer.cfm">
</BODY>
</HTML>
LISTING 3: SEARCH_RESULTS.CFM
<cfparam name="resources" default="">
<cfparam name="itemtitle" default="">
<cfparam name="itemtext1" default="">
<cfparam name="itemtext2" default="">
<cfparam name="freeform1" default="">
<cfparam name="freeform2" default="">
<cfparam name="sp" default="">
<cfparam name="page" default="">
<cfif LEN(TRIM(page)) GT 0>
<cfif LEFT(page,4) IS "http">
<cfset href=page>
<cfelseif LEFT(page,1) IS "/">
<cfset href="http://www.pcamn.org" & TRIM(page)>
<cfelse>
<cfset href="http://www.pcamn.org/" & TRIM(page)>
</cfif>
<cfoutput>
<cfhttp url="#TRIM(href)#" method="post" resolveurl="no">
<cfhttpparam name="itemtitle" value="#itemtitle#" type="formfield">
<cfhttpparam name="itemtext1" value="#itemtext1#" type="formfield">
<cfhttpparam name="itemtext2" value="#itemtext2#" type="formfield">
<cfhttpparam name="freeform1" value="#freeform1#" type="formfield">
<cfhttpparam name="freeform2" value="#freeform2#" type="formfield">
</cfhttp>
<cfif LEN(TRIM(CFHTTP.FileContent)) GT 0>
#REPLACENOCASE(CFHTTP.FileContent,TRIM(sp),'<font style="background-color:
yellow;">#UCASE(TRIM(sp))#</font>',"ALL")#
<cfelse>
<cflocation url="index.cfm">
</cfif>
</cfoutput>
<cfelse>
<cflocation url="index.cfm">
</cfif>