Chapter 11: Indexing and Searching Data
This CFINDEX statement specifies the MessageText column as the core of the
collection and names the table's primary key, the Message_ID column, as the KEY
value. Note that the TITLE attribute names the Subject column. The TITLE attribute
can be used to designate an output parameter.
To index more than one column in a collection, enter a comma-separated list of
column names for values of the BODY attribute, such as:
BODY=FirstName,LastName,Company
Advantages of indexing a data source
The main advantage of performing searches against a Verity collection over using
CFQUERY alone is that the database is indexed in a form that provides faster access.
Use this technique instead of CFQUERY in the following cases:
You want to index textual data. Verity collections containing textual data can be
searched much more efficiently with CFINDEX than searching a database with
CFQUERY.
You want to give your users access to data without interacting directly with the
data source itself.
You want to improve the speed of queries.
You want your end users to run queries but not update a database table.
You do not want to expose your data source.
Indexing CFLDAP Query Results
The widespread use of the Lightweight Directory Access Protocol to build searchable
directory structures, both internally and across the Web, provides ColdFusion
developers with new opportunities to add value to the sites they create. Contact
information or other data from an LDAP-accessible server can be indexed and
searched by users. Remember to create the collection in the Administrator.
Two things to remember when creating an index from an LDAP query:
Because LDAP structures vary greatly, you must know the server's directory
schema and the exact name of every LDAP attribute you intend to use in a
query.
The records on an LDAP server can be subject to frequent change. You may
want to re-index the collection before processing a search request.
In the example below, the search criterion is records with a telephone number in the
617 area code. Generally, LDAP servers use the Distinguished Name (dn) attribute as
the unique identifier for each record, so that is used as the KEY value for the index.
163
Need help?
Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?
Questions and answers