Adobe ColdFusion 8

Using explicit queries

In an explicit query, the Verity search engine literally interprets your search terms. The following are two ways to perform an explicit query:

  • On a search form, use quotation marks around your search term(s).
  • In CFML, use type="explicit" in the cfsearch tag.

When you put a search term in quotation marks, Verity does not use the STEM operator. For example, a search for "instructional"--enclosed in quotation marks, as shown in Preventing stemming--does not return files that contain instruct, instructs, instructions, and so on (unless the files also contain instructional).

Note: The Verity products and documentation refers to the Explicit parser as the BooleanPlus parser.

When you specify type="explicit" the search expression must be a valid Verity Query Language expression. As a result, an individual search term must be in explicit quotation marks. The following table shows valid and invalid criteria:

Attribute

Effect

criteria="government"

Generates an error

criteria="'government'" or criteria='"government"'

Finds only government

criteria="<WORD>government"

Finds only government

criteria="<STEM>government"

Finds government, governments, and governmental

criteria="<MANY><STEM>government"

Finds government, governments, and governmental ranked by relevance

criteria="<WILDCARD>governmen*"

Finds government, governments, and governmental

Using AND, OR, and NOT

Verity has many powerful operators and modifiers available for searching. However, users might only use the most basic operators--AND, OR, and the modifier NOT. The following are a few important points:

  • You can type operators in uppercase or lowercase letters.
  • Verity reads operators from left to right.
  • The AND operator takes precedence over the OR operator.
  • Use parentheses to clarify the search. Terms enclosed in parentheses are evaluated first; innermost parentheses are evaluated first when there are nested parentheses.
  • To search for a literal AND, OR, or NOT, enclose the literal term in double-quotation marks; for example:

    love "and" marriage

Note: Although NOT is a modifier, you use it only with the AND and OR operators. Therefore, it is sometimes casually referred to as an operator.

For more information, see Operators and modifiers.

The following table gives examples of searches and their results:

Search term

Returns files that contain

doctorate AND nausea

both doctorate and nausea

doctorate "and" nausea

the phrase doctorate and nausea

"doctorate and nausea"

the phrase doctorate and nausea

masters OR doctorate AND nausea

masters, or the combination of doctorate and nausea

masters OR (doctorate AND nausea)

masters, or the combination of doctorate and nausea

(masters OR doctorate) AND nausea

either masters or doctorate, and nausea

masters OR doctorate NOT nausea

either masters or doctorate, but not nausea

Using wildcards and special characters

Part of the strength of the Verity search is its use of wildcards and special characters to refine searches. Wildcard searches are especially useful when you are unsure of the correct spelling of a term. Special characters help you search for tags in your code.

Searching with wildcards

The following table shows the wildcard characters that you can use to search Verity collections:

Wildcard

Description

Example

Search result

?

Matches any single alphanumeric character.

apple?

apples or applet

*

Matches zero or more alphanumeric characters. Avoid using the asterisk as the first character in a search string. An asterisk is ignored in a set, ([]) or an alternative pattern ({}).

app*ed

Appleseed, applied, appropriated, and so on

[ ]

Matches any one of the characters in the brackets. Square brackets indicate an implied OR.

<WILDCARD> 'sl[iau]m'

slim, slam, or slum

{ }

Matches any one of a set of patterns separated by a comma,

<WILDCARD> 'hoist{s,ing,ed}'

hoists, hoisting, or hoisted

^

Matches any character not in the set.

<WILDCARD>'sl[^ia]m'

slum, but not slim or slam

-

Specifies a range for a single character in a set.

<WILDCARD> 'c[a-r]t'

cat, cot, but not cut (that is, every word beginning with c, ending with t, and containing any single letter from a to r)

To search for a wildcard character as a literal, place a backslash character before it:

  • To match a question mark or other wildcard character, precede the ? with one backslash. For example, type the following in a search form: Checkers\?
  • To match a literal asterisk, you precede the * with two backslashes, and enclose the search term with either single or double quotation marks. For example, type the following in a search form: 'M\\*' (or "M\\*") The following is the corresponding CFML code:
    <cfsearch name = "quick_search"
        collection="bbb" 
        type = "simple"
    	criteria="'M\\*'">
    

Note: The last line is equivalent to criteria='"M\\*"'>.

Searching for special characters

The search engine handles a number of characters in particular ways as the following table describes:

Characters

Description

, ( ) [

These characters end a text token.

A token is a variable that stores configurable properties. It lets the administrator or user configure various settings and options.

= > < !

These characters also end a text token. They are terminated by an associated end character.

' ` < { [ !

These characters signify the start of a delimited token. They are terminated by an associated end character.

To search for special characters as literals, precede the following nonalphanumeric characters with a backslash character (\) in a search string:

  • comma (,)
  • left parenthesis (
  • right parenthesis )
  • double-quotation mark (")
  • backslash (\)
  • left curly brace ({)
  • left bracket ([)
  • less than sign (<)
  • backquote (`)

In addition to the backslash character, you can use paired backquote characters (` `) to interpret special characters as literals. For example, to search for the wildcard string "a{b" you can surround the string with back quotation marks, as follows:

`a{b`

To search for a wildcard string that includes the literal backquote character (`) you must use two backquote characters together and surround the entire string in back quotation marks:

`*n``t` 

You can use paired back quotation marks or backslashes to escape special characters. There is no functional difference between the two. For example, you can query for the term: <DDA> using \<DDA\> or `<DDA>` as your search term.