User Guide

Table Of Contents
Working with data returned from a query 573
Indexing data returned by a query
Indexing the results of a query is similar to indexing physical files located on your website, with
the added step that you must write a query that retrieves the data you want to search. The
following are the steps to perform a Verity search on record sets returned from a query:
1.
Create a collection.
2.
Write a query that retrieves the data you want to search, and generate a record set.
3.
Index the record set using the cfindex tag.
The
cfindex tag indexes the record set as if it were a collection of documents in a folder
within your website.
4.
Search the collection.
The information returned from the collection includes the database key and other selected
columns. You can then use the information as-is, or use the key value to retrieve the entire row
from the database table.
You should use Verity to search databases in the following cases:
You want to perform full-text search on database data. You can search Verity collections that
contain textual data much more efficiently with a Verity search than using SQL to search
database tables.
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 users to be able to execute queries, but not update database tables.
Unlike indexing documents stored on your web server, indexing information contained in a
database requires an additional step—you must first write a query (using the
cfquery, cfldap, or
cfpop tag) that retrieves the data you want to let your users search. You then pass the information
retrieved by the query to a
cfindex tag, which indexes the data.
When indexing data with the
cfindex tag, you must specify which column of the query
represents the filename, which column represents the document title, and which column (or
columns) represents the document’s body (the information that you want to make searchable).
When indexing a recordset retrieved from a database, the
cfindex tag uses the following
attributes that correspond to the data source:
Attribute Description
key Primary key column of the data source table.
title Specifies a query column name.
body Columns that you want to search for the index.
type If set to
custom, this attribute specifies the columns that you want to index. If set to
file or path, this is a column that contains either a directory path and filename, or a
directory path that contains the documents to be indexed.