
518
DEVELOPING
COLDFUSION 9 APPLICATIONS
Accessing and Using Data
Las
t
upda
te
d 8/5/2010
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
cfindex
tag.
<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>
Search Results -- should be 1 row <br>
<cfoutput query="GetText_Search">
#GetText_Search.TITLE# <br>
</cfoutput>
Evidence operators
Evidence operators let you specify a basic word search or an intelligent word search. A
basic word search
finds
documents that contain only the word or words specified in the query. An
intelligent word search
expands the query
terms to create an expanded word list so that the search returns documents that contain variations of the query terms.
Documents retrieved using evidence operators are not ranked by relevance unless you use the MANY modifier.
Year
Place
Text
1990
Utah
Text about Utah 1990
1990
Oregon
Text about Oregon 1990
1991
Utah
Text about Utah 1991
1991
Oregon
Text about Oregon 1991
1992
Utah
Text about Utah 1992