Operators for Searching Text Fields


This section describes operators that can be used to search document fields.

CONTAINS

Selects documents by matching the word or phrase you specify with values stored in a specific document field. Documents are selected only if the search elements you specify appear in the same sequential and contiguous order in the field value. When you use the CONTAINS operator, you specify the field name to search, and the word or phrase to locate.

With the CONTAINS operator, the words stored in a document field are interpreted as individual, sequential units. You can specify one or more of these units as search criteria. To specify multiple words, each word must be sequential and contiguous and must be separated by a blank space.

For example, the following title contains eight sequential words:

American Version of 'Orient Express' Offers Opulent Ride

The following examples demonstrate how you can use the CONTAINS operator with sequential, contiguous words to match the document title listed above, assuming it is stored in a title field:

TITLE <CONTAINS> American Version

TITLE <CONTAINS> Express Offers

The following examples show how you can use a question mark (?) to represent individual variable characters of a word and an asterisk (*) to match multiple variable characters of a word:

TITLE <CONTAINS> Amer* Version

TITLE <CONTAINS> Version of Or????

Question marks and asterisks cannot be used to represent white space that appears between words.

The CONTAINS operator does not recognize nonalphanumeric characters. The CONTAINS operator interprets nonalphanumeric characters as spaces and treats the separated values as individual units.

For example, if you have defined a dash (-) as a valid character, and you enter search criteria that include this character, as in on-line, the value is defined as two individual units, as follows:

TITLE <CONTAINS> on line

ENDS

Selects documents by matching the character string you specify with the ending characters of the values stored in a specific document field.

For example, assume a document field named AUTHOR has been defined. To select documents written by Milner, Wagner, and Faulkner, enter the following:

AUTHOR <ENDS> ner

MATCHES

Selects documents by matching the character string you specify with values stored in a specific document field. Documents are selected only if the search elements specified match the field value exactly. If a partial match is found, a document is not selected. When you use the MATCHES operator, you specify the field name to search, and the word, phrase, or number to locate.

You can use question marks (?) to represent individual variable characters within a string, and asterisks (*) to match multiple characters within a string.

For example, assume a document field named SOURCE includes the following values:

COMPUTER

COMPUTERWORLD

COMPUTER CURRENTS

PC COMPUTING

To locate documents whose source is COMPUTER, the MATCHES operator is used as follows:

SOURCE <MATCHES> computer

Here, the MATCHES operator matches COMPUTER, but not COMPUTERWORLD, COMPUTER CURRENTS, or PC COMPUTING.

To locate documents whose source is COMPUTERWORLD, the MATCHES operator is used as follows:

SOURCE <MATCHES> computer?????

Now, the MATCHES operator matches COMPUTERWORLD, since each question mark (?) represents specific character positions within the string. COMPUTER and COMPUTER CURRENTS are not matched, because their character strings do not match the length represented by the question marks.

To locate documents whose sources are COMPUTER, COMPUTERWORLD, and COMPUTER CURRENTS, the MATCHES operator is used as follows:

SOURCE <MATCHES> computer*

Here, the MATCHES operator matches COMPUTER, COMPUTERWORLD, and COMPUTER CURRENTS, since the asterisk (*) represents zero or more variable characters at the end of the string.

To locate documents whose sources include COMPUTER, COMPUTERWORLD, COMPUTER CURRENTS, and PC COMPUTING, the MATCHES operator can be used as follows:

SOURCE <MATCHES> *comput*

Now, the MATCHES operator matches all four occurrences, since the asterisk (*) represents a string of characters of any length.

STARTS

Selects documents by matching the character string you specify with the starting characters of the values stored in a specific document field.

For example, assume a document field named REPORTER has been defined. To retrieve documents written by Jack, Jackson, and Jacks, enter the following:

REPORTER <STARTS> jack

SUBSTRING

Selects documents by matching the character string you specify with a portion of the strings of the values stored in a specific document field. The characters that comprise the string can occur at the beginning of a field value, within a field value, or at the end of a field value.

For example, assume a document field named TITLE has been defined. To retrieve documents whose titles contain words such as "solution," "resolution," "solve," and "resolve," enter the following:

TITLE <SUBSTRING> sol





Copyright © 2001, Verity, Inc. All rights reserved.