First you write a <CFQUERY> to retrieve the data you want to index.
You then use this query to pass to <CFINDEX> which indexes the records as
though they were physical files.
You must also tell Verity which column in the query should be a "filename",
which should be a "title" and which column or columns should be the actual
"body".
Eg:
<cfquery name="UserList" datasource="#Request.DataSourceName#">
SELECT
UserID, UserName, UserPassword, UserEmailAddress, UserFirstName,
UserLastName, UserDetails
FROM
Users
</cfquery>
Then:
<cflock type="Exclusive" throwontimeout="yes" timeout="30">
<cfindex query="UserList" collection="UserListCollection"
key="UserID" title="UserName" body="UserDetails" custom1="UserFirstName"
custom2="UserLastName">
</cflock>
<p>Indexing completed...
That's pretty much it! You can then use <CFSEARCH> like this:
<cfsearch collection="UserListCollection" name="SearchResults"
criteria="#Form.SearchCriteria#">
<cfoutput>
<p>#SearchResults.RecordCount# users found for "#Form.SearchCriteria#".
</cfoutput>
<dl>
<cfoutput query="SearchResults">
<dt><i>#NumberFormat(Round(Score * 100))#%</i>
<b>#UserName#</b>
<dd>#Summary#
</cfoutput>
</dl>
You can also reference Key, Custom1 and Custom2 fields. Key for example
could be used to link to another page:
<dl>
<cfoutput query="SearchResults">
<dt><i>#NumberFormat(Round(Score * 100))#%</i>
<b><a href="viewuser.cfm?ID=#Key#">#UserName#</a></b>
<dd>#Summary#
</cfoutput>
</dl>
Hope this helps. The excellent "The Complete Reference: ColdFusion MX",
"Mastering ColdFusion MX" and "Macromedia ColdFusion MX Web Application
Construction Kit" follow this in more detail.
==
Peter Tilbrook
Internet Applications Developer
Australian Building Codes Board
GPO Box 9839
CANBERRA ACT 2601
AUSTRALIA
WWW: http://www.abcb.gov.au/
E-Mail: [EMAIL PROTECTED]
Telephone: +61 (02) 6213 6731
Mobile: 0439 401 823
Facsimile: +61 (02) 6213 7287
-----Original Message-----
From: Larry Juncker [mailto:[EMAIL PROTECTED]]
Sent: Friday, 14 February 2003 8:58 AM
To: CF-Talk
Subject: Verity collections of a database
Can someone explain to me how to create a verity collection of data that is
stored in a database. I am very interested in this but have not been able
to find anything except file verity.
Thanks in advance
Larry Juncker
Senior Cold fusion Developer
Heartland Communications Group, Inc.
[EMAIL PROTECTED]
(515) 574-2122
**********************************************************************
The information contained in this e-mail, and any attachments to it, is
intended for the use of addressee and is confidential. If you are not
the intended recipient, you must not use, disclose, read, forward, copy or
retain any of the information. If you have received this e-mail in
error, please delete it and notify the sender by return e-mail or telephone.
The Commonwealth does not warrant that any attachments are free from
viruses or any other defects. You assume all liability for any loss, damage, or
other consequences which may arise from opening or using the attachments.
**********************************************************************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4