home *** CD-ROM | disk | FTP | other *** search
- <!--- Search the Verity collection for our keyword(s) --->
-
- <CFTRY>
-
- <CFSEARCH COLLECTION="cfexamples"
- CRITERIA="#Form.Keyword#"
- NAME="SearchResults"
- TYPE="SIMPLE">
-
- <CFCATCH TYPE="any">
-
- <CFREGISTRY ACTION=GETALL
- Branch="HKEY_LOCAL_MACHINE\SOFTWARE\Allaire\ColdFusion\CurrentVersion\Collections"
- Type="KEY"
- Name="Collections">
-
- <CFSET CollectionFound = 'No'>
-
- <CFLOOP QUERY="Collections">
-
- <CFIF Collections.Entry IS 'cfexamples'>
- <CFSET CollectionFound = 'Yes'>
- </CFIF>
-
- </CFLOOP>
-
- <CFIF CollectionFound IS 'No'>
-
- <!--- Create the collection --->
-
- <CFREGISTRY ACTION=GET
- Branch="HKEY_LOCAL_MACHINE\SOFTWARE\Allaire\ColdFusion\CurrentVersion\Collections"
- Entry="RootDirectory"
- Type="STRING"
- Variable="CFRootDir">
-
- <CFIF Server.OS.Name IS NOT "UNIX">
- <CFSET CollectionPath="#CFRootDir#\Verity\Collections\">
- <CFELSE>
- <CFSET CollectionPath="#CFRootDir#/verity/collections/">
- </CFIF>
-
- <CFCOLLECTION Action="CREATE"
- Collection="cfexamples"
- Path="#CollectionPath#"
- Language="english">
- </CFIF>
-
-
- <!--- This is the query whose data will be stored in the Verity index --->
- <CFQUERY DATASOURCE="cfexamples" NAME="GetItems">
- SELECT * FROM StoreItems, StoreManufacturers
- WHERE StoreManufacturers.ManufacturerID = StoreItems.ManufacturerID
- </CFQUERY>
-
- <!--- This CFINDEX tag will actually perform the indexing of the query
- data. For each record, all the text in StoreManufacturers.Name,
- StoreItems.ItemName, and StoreItems.ItemDesc will be indexed; when
- a search is performed on this index, the ItemID and ItemName will
- be returned as the Key and Title. --->
-
- <CFINDEX ACTION="UPDATE"
- COLLECTION="cfexamples"
- TYPE="CUSTOM"
- BODY="ItemDesc,Name,ItemName"
- KEY="ItemID"
- CUSTOM1="Name"
- CUSTOM2="ItemPrice"
- TITLE="ItemName"
- QUERY="GetItems">
-
- <CFSEARCH COLLECTION="cfexamples"
- CRITERIA="#Form.Keyword#"
- NAME="SearchResults"
- TYPE="SIMPLE">
-
- </CFCATCH>
-
- </CFTRY>
-
- <!--- OK, start paying attention again... :^) --->
-
- <!--- Check whether the index is properly built ---->
-
- <CFSEARCH
- NAME="CheckSearch"
- COLLECTION="cfexamples"
- CRITERIA = ""
- MAXROWS = "1">
-
- <!--- Now retrieve all the items from the store that
- are part of the recordset CFSEARCH returned to us --->
-
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-
- <HTML>
- <HEAD>
- <TITLE>Online Store - Search Results</TITLE>
- </HEAD>
-
- <BODY BGCOLOR="#FFCC00" LINK="Maroon" BACKGROUND="images/storebg.gif" LEFTMARGIN=5 TOPMARGIN=0>
-
- <CFINCLUDE TEMPLATE="_showcart.cfm">
-
- <SPAN STYLE="position: absolute; left: 205px; top: 10px; width: 300px; z-index: 1">
-
- <!--- Show how many items we found --->
- <P><FONT FACE="Helvetica"><B><CFOUTPUT>#SearchResults.RecordCount#</CFOUTPUT></B> item(s) found.</FONT></P>
-
- <BR><BR>
-
- <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="350">
-
- <!--- Now we'll just show the items that match the search,
- if any; this code is taken straight from showitems.cfm. --->
- <CFOUTPUT QUERY="SearchResults">
-
- <FORM ACTION="additem.cfm" METHOD="POST">
-
- <INPUT TYPE="HIDDEN" NAME="ItemID" VALUE="#Key#">
-
- <TR>
- <TD><FONT FACE="Helvetica" SIZE="-1" COLOR="##000000"><B>#Title#</B></FONT></TD>
- <TD ALIGN="RIGHT">
- <FONT FACE="Helvetica" SIZE="-1" COLOR="##000000">#DollarFormat(Custom2)#</FONT>
- </TD>
- </TR>
-
- <TR>
- <TD COLSPAN="2">
- <FONT FACE="Helvetica" SIZE="-1">#Summary#<BR><BR>
- <B>Manufacturer: </B>#Custom1#<BR>
- <!--- <B>Part Number:</B> #PartNum#</FONT> --->
- </TD>
- </TR>
-
- <TR>
- <TD COLSPAN="2" ALIGN="RIGHT"><FONT FACE="Helvetica" SIZE="-1">
- <INPUT TYPE="SUBMIT" VALUE="Add to Cart"></FONT></TD>
- </TR>
-
- <TR>
- <TD COLSPAN="2" HEIGHT="50"></TD>
- </TR>
-
- </FORM>
-
- </CFOUTPUT>
-
- </TABLE>
- </SPAN>
-
- </BODY>
- </HTML>
-