ColdFusion MX Professional Projects

When you use <CFSEARCH>, you can specify the type of search to be performed by using the TYPE attribute. This attribute can be set to either Simple, which is the default, or Explicit.

A simple query expression is typically a word or a set of words. An explicit query expression makes use of 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 invoked explicitly. A simple query expression employs operators by default.

The Verity query language provides a number of operators and modifiers to compose queries. You can use these search techniques to search a Verity collection:

Simple Query Expressions

These queries allow end users to enter simple, comma-delimited strings and use wildcard characters. A simple query searches for words, not strings. For example, entering the word all will find documents containing the word "all," but not "allegorical." You can use wildcards to broaden the scope of the search. all* will return documents containing both "all" and "alliterate."

You can also enter multiple words separated by commas. In a simple query expression, the comma is just like a logical OR. If commas are omitted, the query expression is treated as a phrase.

Usually, operators are employed in explicit query expressions. They're normally surrounded by angle brackets (< >). You can also use AND, OR, and NOT in a simple query without using angle brackets. To include an operator in a search, surround it with double quotation marks.

By default, a simple query employs the STEM operator and the MANY modifier. The STEM operator searches for words that can be derived from those entered in the query expression. As a result, entering shift will return documents that contain "shift," "shifting," "shifts," and so on. The MANY modifier counts the number of times a particular search term is encountered when a record is being searched.

When you use the simple syntax, the search engine implicitly interprets single words as though they were modified by the MANY and STEM operators. By applying the MANY modifier implicitly, the search engine calculates each document's score based on the density of the search term in the searched documents. The more frequent the occurrence of a word in a document, the higher the document's score. The search engine ranks documents according to word density since it searches for the word you specify, as well as words that have the same stem.

Explicit Query Expressions

These queries can be constructed using a variety of operators, such as evidence, proximity, relational, concept, and score. Most operators in an explicit query expression are surrounded by angle brackets (< >). The AND, OR, and NOT operators can be used without angle brackets.

When you use explicit syntax, the search engine interprets the search terms you enter as literals. For example, when you enter the word "find" (including quotation marks) using explicit syntax, the stemmed versions of the word such as "finds" and "finding" are ignored.

Using Operators

An operator applies logic and rules to a search element. Logic defines the qualifications a document must meet to be retrieved. Operators are used with a form-based search or when they're hard-coded into the application. All operators except AND, OR, and NOT need to be enclosed in angle brackets to keep the Verity engine from treating them as literal search terms. The syntax for using operators is

"<operator>search_string"

These are the various types of operators:

Wildcards

These operators return all records that match the wildcard character used in the search criteria. Wildcard operators use back quotes (`) to enclose the search string. These are the various wildcard characters used in Verity:

To search for a wildcard character as a literal, you need to escape it by placing a backslash before it. For example, when you search for "Why?", the question mark needs to be escaped as "Why\?".

Evidence Operators

These operators find words that are similar to a particular word. A basic word search matches only that particular word. Evidence search is an intelligent search that looks for additional words, which can be related to the basic search term.

These are the various types of evidence operators:

Proximity Operators

These operators demarcate the proximal location within a record. They search for records that contain search terms within the same phrase or sentence. Records generated as a result of this search are ranked. These are some proximity operators:

Relational Operators

These operators look for specified document fields within collections. There are five Verity document fields: TITLE, KEY, URL, CUSTOM1, and CUSTOM2. In ColdFusion, these fields are known as CF_TITLE, CF_KEY, CF_URL, CF_CUSTOM1, and CF_CUSTOM2. The MANY operator cannot be used with relational operators.

These relational operators are used for text comparisons:

These relational operators are used for data comparisons:

Concept Operators

These operators identify a concept in a document by linking a group of search terms using the criteria specified by the operator. Retrieved records are ranked on the basis of the density of the search criteria.

Here are some concept operators:

Score Operators

These operators help to determine the scores of the records that match the search criteria. Documents are rated as a decimal percentage between 0 and 1,000, based on the operators applied to the search criteria.

Here are the score operators:

Modifier Operators

These operators change the behavior of standard operators in a predetermined way. Here are the modifier operators:

Special Characters

The Verity search engine handles a number of characters in a special way:

A backslash (\) is used for escaping and removes the special meaning of the character that follows it. To enter a literal backslash in a query, use two in succession:

<FREETEXT>("\"There is nothing\", said Marshall.")"backslash (\\)"

Категории