MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual page 547

Developing coldfusion mx applications
Table of Contents

Advertisement

To locate documents whose source is Computer, Computerworld, Computer Currents, and PC
Computing, enter the following:
SOURCE <MATCHES> *comput*
For an example of ColdFusion code that uses the CONTAINS relational operator, see
searches" on page
553.
You can use the SUBSTRING operator to match a character string with data stored in a specified
data source. In the example described in this section, a data source called TEST1 contains the
table YearPlaceText, which contains three columns: Year, Place, and Text. Year and Place make up
the primary key. The following table shows the TEST1 schema:
Year
Place
1990
Utah
1990
Oregon
1991
Utah
1991
Oregon
1992
Utah
The following application page matches records that have 1990 in the TEXT column and are in
the Place Utah. The search operates on the collection that contains the TEXT column and then
narrows further by searching for the string "Utah" in the CF_TITLE document field. Document
fields are defaults defined in every collection corresponding to the values that you define for URL,
TITLE, and KEY in the
<cfquery name="GetText"
datasource="TEST1">
SELECT Year+Place AS Identifier, text
FROM YearPlaceText
</cfquery>
<cfindex collection="testcollection"
action="Update"
type="Custom"
title="Identifier"
key="Identifier"
body="TEXT"
query="GetText">
<cfsearch name="GetText_Search"
collection="testcollection"
type="Explicit"
criteria="1990 and CF_TITLE <SUBSTRING> Utah">
<cfoutput>
Record Counts: <br>
#GetText.RecordCount# <br>
#GetText_Search.RecordCount# <br>
</cfoutput>
Query Results --- Should be 5 rows <br>
<cfoutput query="Gettext">
#Identifier# <br>
</cfoutput>
Text
Text about Utah 1990
Text about Oregon 1990
Text about Utah 1991
Text about Oregon 1991
Text about Utah 1992
tag.
cfindex
Composing search expressions
"Field
547

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents