<cfcollection action="create" collection="images"
path="E:\images_collection\"
language="English">
<cfindex action="refresh" collection="images"
key="filename"
type="custom" query="get_images" title="alt_text"
body="metadata"
custom1="custom1" custom2="custom2" language="English">
LISTING 2: Example of Meshing Together Database
Data and File Data
<cfquery name="get_images" datasource="#datasource#">
SELECT 'http://www.ffoobar.com/index.cvy?fuseaction=show_image&image_id='
+
convert(varchar, image_id) + '&category_id='
+ convert(varchar, category_id) +
' ' AS url, 'E:\images\' + image_text AS
image_path, alt_text,
filename + ',' + metadata + ',' + convert(varchar,
width) +
',' + convert(varchar, height) as custom1,
convert(varchar, category_id) + ',' + extension
as custom2
FROM tbl_images
</cfquery>
<cfcollection action="create" collection="images"
path="E:\images_collection\" language="English">
<cfindex action="REFRESH" collection="image_collection"
query="get_images"
type="FILE" key="image_path" title="alt_text"
urlpath="url" custom1="custom1"
custom2="custom2" language="English" extensions=".txt">
LISTING 3: Example of Client Verity Search
Engine Template
<!---
The fields returned by the Verity Server
are as follows:
URL:
full url to the image page
Custom 1:
width,height
Custom 2:
category_id,extension
Key:
filename
Title:
alt_text
--->
<!--- clean search string with custom
tag from Allaire's site --->
<cf_verity_clean input="#form.search_criteria#"
output="form.search_criteria">
<!---http to the verity server to fetch
results--->
<cflock name="cfhttp" type="exclusive"
timeout="10" throwontimeout="Yes">
<cfhttp
url="#application.verityurl#search_engine.cfm?action=search&
search_criteria=#urlencodedformat(lcase(form.search_criteria))#"
method="GET" resolveurl="false" timeout="10">
</cfhttp>
</cflock>
<cfif cfhttp.filecontent EQ 0>
<!---empty results--->
<cfset search_articles = querynew("")>
<cfelseif comparenocase(cfhttp.filecontent,
"connection failure")>
<!---deserialize the query--->
<cfwddx action="WDDX2CFML" input="#cfhttp.filecontent#"
output="search_results">
<cfelse>
<!---verity server is down: "connection
failure"--->
<cfoutput>Sorry, our search engine
is temporarily unavailable. Please
try again later.
<BR><BR></cfoutput><cfabort>
</cfif>
<cfoutput>Your Search For #form.searchcriteria#
Found
#search_results.recordcount# Results</cfoutput>
<cfoutput>
<table>
<tr>
<td>Image Text</td><td>File
Name</td><td>Extension</td><td>Width</td><td>Height</td>
</tr>
</cfoutput>
<cfoutput query="search_articles">
<tr>
<td><ahref ="#url#">#title#</a></td>
<td>#key#</td>
<td>#listlast(custom2)#</td>
<td>#listfirst(custom1)#</td>
<td>#listlast(custom1)#</td>
</tr>
</cfoutput>
<cfoutput></table></cfoutput>
LISTING 4: Example of Server Verity Search
Engine Template
<cfswitch expression="#url.action#">
<cfcase value="search">
<!---search for within
a publication: articles only--->
<cfsearch collection="image_collection"
name="search_images"
type="SIMPLE" criteria="#url.search_criteria#"
maxrows="1000"
language="English">
<cfif search_articles.recordcount>
<cfwddx
action="CFML2WDDX" input="#search_articles#"
output="wddx_output">
<cfoutput>#wddx_output#</cfoutput>
<cfelse>
<cfoutput>0</cfoutput>
</cfif>
</cfcase>
<!--- client code for update functionality
is not shown but can be easily
figured out -
simply encode the update query into
WDDX and post it to this template --->
<cfcase value="update">
<!---decode the query--->
<cfwddx action="WDDX2CFML"
input="#form.imagewddx#" output="imagequery">
<cfindex action="UPDATE"
collection="image_collection" type="custom"
key="key" title="title"
query="pubquery" body="body" custom1="custom1"
custom2="custom2"
language="english">
<!--- return
a success status code --->
<cfoutput>1</cfoutput>
</cfcase>
</cfswitch>