526
Chapter 24: Building a Search Interface
Working with record sets
The
cfquery
,
cfldap
, and
cfpop
tags return the results of a database query in a record set. In
some cases, you might want to search the record set. This section describes the reasons and
procedures for indexing the results of database, LDAP, and pop queries. It also describes how a
database can direct the indexing process, using different values for the
type
attribute of the
cfindex
tag.
Indexing database record sets
The following are the steps to perform a Verity search on record sets:
1
Write a query to generate a record set.
2
Index the record set.
3
Search the record set.
Performing searches against a Verity collection rather than using
cfquery
provides faster access,
because the Verity collection indexes the database. Use this technique instead of
cfquery
in the
following cases:
•
You want to index textual data. You can search Verity collections containing textual data much
more efficiently with a Verity search than with a SQL query.
•
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 users to run queries but not update database tables.
Indexing the record set from a ColdFusion query involves an extra step not required when you
index documents. You must code the query and output parameters, and then use the
cfindex
tag
to index the record set from a
cfquery
,
cfldap
, or
cfpop
query.
You write a
cfquery
that retrieves the data to index, then you pass this information to a
cfindex
tag, which populates the collection. The
cfindex
tag contains the following attributes that
correspond to the data source:
Using the
cfindex
tag on large custom query data can cause a “Java out of memory error” or lead
to excessive disk use on your computer. Because ColdFusion reads custom queries into memory, if
the query size is larger than your physical memory, then paging of physical memory to disk
occurs. The size of physical memory used is the smaller of the actual physical memory on your
computer and the Java Virtual Machine (JVM) masimum memory parameter. You can specify the
JVM parameter in the Administrator or in the configuration file cfusionmx/runtime/bin/
jvm.config by the argument [-Xmx512m].
The following procedure assumes that you have a Verity collection named CodeColl. For more
information, see
“Creating a collection with the cfcollection tag” on page 518
. The following
procedure uses the CompanyInfo data source that is installed with ColdFusion.
The cfindex
attribute
Description
key
Primary key of the data source table
title
Specifies a query column name
body
Column(s) that you want to search for the index
Summary of Contents for ColdFusion MX
Page 1: ...Developing ColdFusion MX Applications...
Page 22: ...22 Contents...
Page 38: ......
Page 52: ...52 Chapter 2 Elements of CFML...
Page 162: ......
Page 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Page 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Page 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Page 266: ......
Page 314: ...314 Chapter 14 Handling Errors...
Page 344: ...344 Chapter 15 Using Persistent Data and Locking...
Page 349: ...About user security 349...
Page 357: ...Security scenarios 357...
Page 370: ...370 Chapter 16 Securing Applications...
Page 388: ...388 Chapter 17 Developing Globalized Applications...
Page 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Page 410: ......
Page 426: ...426 Chapter 19 Introduction to Databases and SQL...
Page 476: ...476 Chapter 22 Using Query of Queries...
Page 534: ...534 Chapter 24 Building a Search Interface...
Page 556: ...556 Chapter 25 Using Verity Search Expressions...
Page 558: ......
Page 582: ...582 Chapter 26 Retrieving and Formatting Data...
Page 668: ......
Page 734: ...734 Chapter 32 Using Web Services...
Page 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Page 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Page 788: ......