words of the sequence. A document matches a proximity word sequence if all words occur in the document in the same order, with at most N intervening words, where N is the proximity value.

For example, the sequence "bird garden stone"~3 matches any document that has these three words in this order, with bird and garden separated by no more than three words, and garden and stone separated by no more than three words. This sequence matches a document with the text a bird in the rose garden is near a stone because there are at most three words between successive sequence words. This sequence also matches a bird garden with a stone for the same reason.

Simple word sequences are a special case of proximity word sequences: ". . ." is the same as ".

. ."~0. Any documents found by ". . ."~N are also found by ". . ."~M, when M > N.

Boolean query expressions

You can combine words, fuzzy words, and word sequences using Boolean (logical) operators AND, OR, and NOT (these must be uppercase). The following table describes Boolean operators, where exp, exp1, and exp2 represents a word, fuzzy word, word sequence, or other Boolean query expression.

Table 10 Boolean query expressions

Syntax

 

Matches

 

 

 

NOT exp

 

all documents that do not match exp

alternative syntax:

- exp

 

alternative syntax:

! exp

 

 

 

 

exp1 OR exp2

 

all documents that match either exp1 or exp2

 

 

 

exp1 AND exp2

 

all documents that match both exp1 and exp2

alternative syntax: exp1 && exp2

 

alternative syntax: exp1exp2

 

 

 

 

NOTE:

The second alternative syntax for AND indicates that AND is the default connective in query expressions. You do not need to supply AND explicitly. It is assumed if neither AND nor OR is used explicitly. For example, the query peace quiet is equivalent to the query peace AND quiet.

A NOT expression must be combined, using AND or OR, with another expression other than NOT. A query cannot consist solely of negative criteria.

NOT quiet

illegal

 

 

(NOT quiet) AND (NOT blue)

illegal

 

 

NOT quiet AND blue

legal

 

 

NOT quiet OR nois*

legal

 

 

You must provide the proper number of arguments for a Boolean operator or an error message results: one argument for NOT (- or !), two arguments for AND (&& ) and OR. For example, the following queries result in an error message.

alpha NOT: Missing argument for NOT

AND alpha: Missing argument for AND

Boolean operators must be surrounded by one or more separators, typically white space. For example, the query peas&&carrots is not equivalent to the query peas && carrots; peas&&carrots is a single word (& is a word character).

Negation operators (- and !) are exceptions to this rule. They must be preceded by a separator, but they need not be followed by a separator. For example, carrot-a6is a single query word, but carrot -a6, like carrot (- a6), is equivalent to the Boolean expression carrot AND (NOTa6).

User Guide

37