Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 493

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Accessing and Using Data
cfquery
Uses SQL statements to specify search criteria
Returns variables keyed to database table field names
Uses
cfoutput
to display query results
Note: You receive an error if you attempt to search a collection that has not been indexed.
The following are important attributes for the
Attribute
name
collection
criteria
maxrows
Each
returns variables that provide the following information about the search:
cfsearch
Attribute
RecordCount
CurrentRow
RecordsSearched
Summary
Context
Additionally, if you specify the
information in the following table:
Variable
found
searched
time
suggestedQuery
Keywords
You can use search form and results pages like the following examples to search a collection.
Create a search form
Create a ColdFusion page with the following content:
1
cfsearch
Uses a criteria attribute to specify search criteria
Returns a unique set of variables
Uses
cfsearch
Description
The name of the search query.
The name of the collection(s) being searched. Separate multiple collections with a comma; for example,
collection = "sprocket_docs,CodeColl".
The search target (can be dynamic).
The maximum number of records returned by the search. Always specify this attribute to ensure optimal
performance (start with 300 or less, if possible).
Description
The total number of records returned by the search.
The current row of the recordset.
The total number of records in the index that were searched. If no records are returned in the search, this
property returns a null value.
Automatic summary saved by the
A context summary that contains the search terms, highlighted in bold (by default). This is enabled if you
set the
contextpassages
attribute to a number greater than zero.
attribute, the
status
cfsearch
Description
The number of documents that contain the search criteria.
The number of documents searched. Corresponds to the
The number of milliseconds the search took, as reported by the Verity K2 search service.
An alternative query, as suggested by Verity, that may produce better results. This often contains corrected
spellings of search terms. Present only when the
A structure that contains each search term as a key to an array of up to five possible alternative terms in order
of preference. Present only when the
Last updated 1/20/2012
cfoutput
to display search results
tag:
tag.
cfindex
tag returns the status structure, which contains the
recordsSearched
tag attribute criteria is met.
suggestions
suggestions
tag attribute criteria is met.
488
column in the search results.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents