Chapter 11: Indexing and Searching Data
<!--- Run POP query --->
<CFPOP ACTION="getall"
NAME="p_messages
SERVER="mail.mycompany.com"
USERNAME="user1"
PASSWORD="user1">
<!--- Output POP query result set --->
<CFOUTPUT QUERY="p_messages">
#MESSAGENUMBER# <BR>
#FROM# <BR>
#TO# <BR>
#SUBJECT# <BR>
#BODY# <BR>
=========================<BR>
<!--- Index result set --->
<CFINDEX ACTION="update"
COLLECTION="pop_query"
KEY="messagenumber"
TYPE="custom"
TITLE="subject"
QUERY="p_messages"
BODY="body">
<!--- Search messages for the word "action" --->
<CFSEARCH COLLECTION="pop_query"
NAME="s_messages"
CRITERIA="action">
<!--- Output search result set --->
<CFOUTPUT QUERY=" s_messages">
#Key#, #Title# <BR>
</CFOUTPUT>
The CFSEARCH code in the examples above uses the basic attributes needed to search
a collection. The next section expands on the capabilities of this tag for more detailed
input and output options.
Using Query Expressions
When you search a Verity collection, you use the CFSEARCH tag in a ColdFusion
application page. Use the CRITERIA attribute to specify the query expression you want
to pass to the search engine.
You can build two types of query expressions: simple and explicit. A simple query
expression is typically a word or words. An explicit query expression can employ a
number of operators and modifiers to refine the search. Although an explicit query can
employ operators and modifiers, all aspects of the search must be explicitly invoked. A
simple query expression is somewhat more powerful since it employs operators by
default. You can assemble an explicit query expression programmatically or simply
165