Module
zope.index.text.queryparser

Query Parser.

This particular parser recognizes the following syntax:

Start = OrExpr OrExpr = AndExpr (OR AndExpr)* AndExpr = Term (AND NotExpr | NOT AndExpr)* NotExpr = ['NOT'] Term Term = '( OrExpr )' | ATOM+

The key words (AND, OR, NOT) are recognized in any mixture of case.

An ATOM is either:

+ A sequence of characters not containing whitespace or parentheses or double quotes, and not equal (ignoring case) to one of the key words AND, OR, 'NOT'; or

+ A non-empty string enclosed in double quotes. The interior of the string can contain whitespace, parentheses and key words, but not quotes.

+ A hyphen followed by one of the two forms above, meaning that it must not be present.

An unquoted ATOM may also contain globbing characters. Globbing syntax is defined by the lexicon; for example "foo*" could mean any word starting with "foo".

When multiple consecutive ATOMs are found at the leaf level, they are connected by an implied AND operator, and an unquoted leading hyphen is interpreted as a NOT operator.

Summarizing the default operator rules: