User Guide
294 Chapter 15 Indexing and Searching Data
Document fields
You can specify the values for the cfindex attributes TITLE, KEY, URL, and CUSTOM
as document fields for use with relational operators in the
criteria attribute.
Document fields are referenced in text comparison operators. They are identified as:
• CF_TITLE
• CF_KEY
• CF_URL
• CF_CUSTOM1
• CF_CUSTOM2
For more information on this topic, see the Knowledge Base article, “Verity: Using
Document Fields To Narrow Down Searches” (ID# 1082) on our Web site at http://
www.coldfusion.com/Support/KnowledgeBase/SearchForm.cfm.
The SUBSTRING operator
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 itself contains three columns: Year,
Place, and Text. Year and Place make up the primary key. The following table shows
the TEST1 schema:
The following application page matches records that have 1990 in the TEXT column
and are in the Place Utah. The search is performed against the collection that
contains the TEXT column and then is narrowed further by searching for the string
“Utah” in the CF_TITLE document field. Recall that document fields are defaults
defined in every collection corresponding to the values 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"
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