Cfsearch Properties; Indexing Database Query Results - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

162

CFSEARCH properties

Three properties are generated for each CFSEARCH query that provide information
about a particular query:
RecordCount — The total number of records returned by the query.
CurrentRow — The current row of the query being processed by CFOUTPUT.
RecordsSearched — The total number of records in the index that were
searched. If no records were returned in the search, this property returns a null
value.

Indexing database query results

Indexing the result set from a ColdFusion query involves an extra step not required
when indexing documents. You need to code the query and output parameters, then
point the CFINDEX tag at the result set from a CFQUERY, CFLDAP, or CFPOP query.
To index a ColdFusion query:
1.
Create the collection on the ColdFusion Administrator Verity page.
2.
Execute a query and output the data.
3.
Populate the collection using the CFINDEX tag.
To populate a collection from a CFQUERY you specify a KEY, which corresponds to the
primary key of the data source, and the BODY, the column in which you want to
conduct searches. The following extract shows only the CFQUERY and CFINDEX parts
of the process.
<!--- Select the entire table --->
<CFQUERY NAME="Messages"
DATASOURCE="MyMail">
SELECT *
</CFQUERY>
<!--- Output the result set --->
<CFOUTPUT QUERY="Messages">
#Message_ID#, #Subject#, #Title#, #MessageText#
</CFOUTPUT>
<!--- Index the result set --->
<CFINDEX COLLECTION="DBINDEX"
ACTION="UPDATE"
TYPE="CUSTOM"
BODY="MessageText"
KEY="Message_ID"
TITLE="Subject"
QUERY="Messages">
FROM Messages
Developing Web Applications with ColdFusion

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 4.5

Table of Contents