Refining a search query using operators

Search operators are words and characters that search for words, fields, dates, and numbers in specific combinations. Search operators work the same way they do in most Web search engines--that is, they are based on Boolean logic--with some very powerful enhancements.

For example, you can create a search for two words that appear in the same document, specifying how close they should be to one another, what field they must be in, and their exact case. In addition, you can specify that one word should be judged as more important than the other, so documents containing the first word appear closer to the beginning of the list of search results. Using wildcards, you can also search for word fragments.

To use an operator in your search, enter it into the text entry box in the Search bar, using a format shown in table 1.

Web query syntax

The operators listed and described in the Notes® query syntax table work for web-style search query syntax with the following qualifiers:

  • Operators must be in all uppercase in order to apply properly for a web-style query. If you enter an operator in lowercase (such as, accrue or exactcase), Search assumes it is being used as an actual term instead of as an operator.
  • The exceptions to this rule are the common word operators AND, OR, and NOT, which do not have to be in uppercase. Note, however, that NOT is not an operator, so if the word NOT, in any case, precedes a word without a needed operator, AND will be added, for instance (cats not dogs) => (cats and not dogs). In Web query syntax, the - (minus sign) is the operator that has the meaning not.
  • An asterisk used as a wildcard can only be used at the end of a search term, not at the beginning or in the middle of the term.

Notes® query syntax

Operators are reserved words in Notes®. If you want to search for an operator as you would normal text, for example in a phrase such as Gene and Joan, you must put the phrase in quotes.

The following operators work if Notes® query syntax is the selected preference. They also work for Web query syntax with the exceptions described in the preceding section.

Table 1. Operators

Operator

Description and examples

Where operator works

CONTAINS

contains

=

Requires that the field before it must contain the text after it. There should be spaces between CONTAINS and words surrounding it.

Example:

[Projectname] CONTAINS highly confidential

Finds documents whose Projectname field contains the words highly confidential.

Notes view - Yes

Notes domain - Yes

Web view/domain - No

IS PRESENT

Requires that the field before it must be non-blank. There should be spaces between IS PRESENT and words surrounding it. This operator can be used to find all documents that do (or do not) contain a value in a particular field.

Example:

[Subject] IS PRESENT

Finds documents whose Subject field is non-blank.

Notes view - Yes

Notes domain - Yes

Web view/domain - No

field fieldname

FIELD fieldname

[fieldname] (use square-style brackets [ ])

Means search this field; you must specify the field to search by using its field name.

Example:

Each of the following are equivalent ways to find documents whose Projectname field contains the phrase highly confidential:

FIELD Projectname CONTAINS highly confidential

field Projectname CONTAINS highly confidential

[Projectname] CONTAINS highly confidential

Note: Notes® stores file attachments in the $FILE field.

Notes view - Yes

Notes domain - No

Web view/domain - Yes, but in view searches only

( ) [parentheses]

Determines the order in which sections of your query are processed. A part of the query enclosed in parentheses will be processed before parts outside the parentheses.

Example:

(FIELD Projectname CONTAINS highly confidential OR FIELD Title CONTAINS tuna) AND (Field body CONTAINS cat OR Field revdate > 01/01/2004)

Return documents whose Projectname field contains the words highly confidential or whose title field contains the word tuna; and either the body field contains the word cat or the revdate field contains a date greater than 01/01/2004.

Notes view - Yes

Notes domain - No

Web view/domain - Yes

and

AND

&

+

Finds documents containing all the conditions or words linked by AND.

Example:

cat AND dog AND fish

Finds documents containing all three of these words.

Notes view - Yes

Notes domain - Yes

Web view/domain - Yes except & does not work

or

OR

|

ACCRUE

, (comma)

Finds documents containing either of the conditions or words and returns them ranked by number of appearances in the document.

Example:

cat OR dog OR fish

Finds documents containing at least one of these words.

Note: ACCRUE works slightly better than OR when sorting results by relevance.

Notes view - Yes

Notes domain - Yes

Web view/domain - Yes

NOT

not

!

Excludes documents containing the term that appears after the operator.

Examples:

You can put NOT between words:

  • cat AND NOT dog – Finds documents containing the word cat, but not if they also contain the word dog.
  • (cat OR dog) AND NOT (fish OR frogs) – Finds documents containing the word cat or dog, but not if they also contain the word fish or frog.
  • (cat AND dog) AND NOT fish – Finds documents containing the words cat and dog, but not if they also contain the word fish.

You can put NOT before any field name:

  • NOT [Projectname] CONTAINS highly confidential – Finds documents whose Projectname field does not contain the words highly confidential.

You cannot put NOT after the math symbols =, <, >, <=, or >=; and before a date or number:

  • [date1] = NOT 12/25/2002 is not an appropriate query.

Notes view - Yes

Notes domain - Yes

Web view/domain - Yes

Requires that only documents containing the exact phrase are returned. Placing double quotes around operators (like AND, OR, CONTAINS etc.) allows them to be read as normal words.

Example:

rock and roll

Finds documents containing the phrase rock and roll

Notes view - Yes

Notes domain - Yes

Web view/domain - Yes

PARAGRAPH

paragraph

Finds documents in which the words surrounding PARAGRAPH are in the same paragraph, and ranks them by how close they are.

Example:

car PARAGRAPH wheels

Finds documents in which car and wheels appear in the same paragraph and ranks them by how close the words are within the paragraph.

Notes view - Yes

(If the application’s full-text index has been created with the Index sentence and paragraph breaks option selected. For more information, see Full-text index options.)

Notes domain - Yes

Web view/domain - No

SENTENCE

sentence

Finds documents in which the words surrounding SENTENCE are in the same sentence, and ranks them by how close they are.

Example:

car SENTENCE wheels

Finds documents in which car and wheels appear in the same sentence and ranks them by how close the words are within the sentence.

Notes view - Yes

(If the application’s full-text index has been created with the Index sentence and paragraph breaks option selected. For more information, see Full-text index options.)

Notes domain - Yes

Web view/domain - No

?

A wildcard that can represent any single letter. It does not work with dates or numbers.

Examples:

?one

Finds documents containing bone, cone, done, gone (and any other four-letter words that end with one)

???ck

Finds documents containing stack, clock, stick, truck; rack, rick, rock

Notes view -Yes

Notes domain - Yes

Web view/domain - Yes

*

A wildcard that can represent any extension of letters. It does not work with dates or numbers.

Examples:

*one

Finds documents containing bone, cone, clone, crone, done, drone, gone, telephone (and any other words of any length that end with one).

Also,

*one*

Finds documents containing bone, cone, clone, lonely, phoned, stoned, pardoned.

Notes view - Yes

Notes domain - Yes

Web view/domain - Yes

TERMWEIGHT

termweight

Gives importance, or weight, to search words. You can use any value from 0 through 65537 to assign weight.

Example:

TERMWEIGHT 25 photo or TERMWEIGHT 75 audio or TERMWEIGHT 50 video

Finds documents containing at least one of the words. Audio is most important, video is next, and photo is least important. Notes® ranks results accordingly. You need an AND or OR between first TERMWEIGHT and subsequent ones.

Notes view - Yes

Notes domain - Yes

Web view/domain - No

EXACTCASE

exactcase

Search for the exact case of the word specified after the operator.

Example:

exactcase Apple

Finds documents containing Apple, but not APPLE or apple.

Notes view - Yes

(If the application’s full-text index has been created with the Enabled case sensitive searches option selected. For more information, see Full-text index options.)

Notes domain - No

Web view/domain - No

= (equal)

< (less than)

> (greater than)

<= (less than or equal)

>= (greater than or equal)

Search for numbers or dates in numeric or date fields only.

Example:

FIELD date1<12/25/98

Finds documents whose date1 field contains any date before 12/25/98.

Notes view - Yes

Notes domain - Yes

Web view/domain - No

- (hyphen)

Finds documents with the hyphenated word pair.

Example:

full-text

Finds documents containing full-text.

Notes view - Yes

Notes domain - Yes

Web view/domain - Yes

Field name special cases

Use the fieldname _CreationDate to find documents by the date they were created. For example,

[_CreationDate]=1/05/2001

finds documents created on January 5, 2001.

Use the fieldname _RevisionDate to find documents by the day they were last modified. For example,

[_RevisionDate]=1/05/2001 

finds documents that were last modified on January 5, 2001.

These fields are contained in a document’s header, not the document itself, and are therefore not in the list of field names found in the Document properties dialog box.

Note: If a language does not support the concept of uppercase, then any word that is also an operator will be treated as an operator.