
434
DEVELOPING
COLDFUSION 9 APPLICATIONS
Accessing and Using Data
Las
t
upda
te
d 8/5/2010
Using Query of Queries with non-SQL recordsets
A Query of Queries can operate on any CFML tag or function that returns a recordset; you are not limited to operating
on
cfquery
results. You can perform queries on non-SQL recordsets, such as a
cfdirectory
tag, a
cfsearch
tag, a
cfldap
tag, and so on.
The following example shows how a Query of Queries interacts with the recordset of a Verity search. This example
assumes that you have a valid Verity collection, called bbb, which contains documents with a target word, film, or its
variants (films, filmed, filming). Change the name of the collection and the search criteria to as appropriate for your
Verity collection. For more information on Verity, see “
Building a Search Interface
” on page 476.
Use Query of Queries with a Verity recordset
1
Create a ColdFusion page with the following content:
<html>
<head>
<title>QoQ and Verity</title>
</head>
<body>
<!--- Master query: retrieve all documents from the bbb collection
that contain 'film' (or its stemmed variants); change values for
collection and criteria as needed for your Verity collection. --->
<cfsearch name = "quick"
collection="bbb"
type = "simple"
criteria="film">
<h3>Master query dump:</h3>
<cfdump var="#quick#">
<!--- Detail query: retrieve from the master query only those
documents with a score greater than a criterion (here,
0.7743). --->
<cfquery name="qoq" dbtype="query">
SELECT * from quick
WHERE quick.score > 0.7743
</cfquery>
<h3>Detail query dump:</h3>
<cfdump var="#qoq#">
</body>
</html>
2
Save the page as qoq_verity.cfm in the myapps directory under the
web_root
.
3
Display qoq_verity.cfm in your browser
The next example shows how a Query of Queries combines recordsets from a
cfdirectory
tag, which is limited to
retrieval of one file type per use.
Use Query of Queries to combine recordsets
1
Create a ColdFusion page with the following content:
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...