User Guide

Table Of Contents
596 Chapter 25: Using Verity Search Expressions
To locate documents whose source is Computer, Computerworld, and Computer Currents, enter
the following:
SOURCE <MATCHES> computer*
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 “Field
searches” on page 603.
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:
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>
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