For ZCTextIndex one can read the doc in the source code of
Zope-2.7/lib/python/Products/ZCTextIndex/QueryParser.py :
This particular parser recognizes the following syntax:
Start = OrExpr
OrExpr = AndExpr ('OR' AndExpr)*
AndExpr = Term ('AND' NotExpr)*
NotExpr = ['NOT'] Term
Term = '(' OrExpr ')' | ATOM+
The key words (AND, OR, NOT) are recognized in any mixture of case.
An ATOM is one of the following:
- 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:
- a sequence of words without operators implies AND, e.g. foo
bar.
- double-quoted text implies phrase search, e.g. "foo bar".
- words connected by punctuation implies phrase search, e.g.
foo-bar.
- a leading hyphen implies NOT, e.g. foo -bar.
- these can be combined, e.g. foo -"foo bar" or foo
-foo-bar.
- "*" and "?" are used for globbing (i.e. prefix search), e.g.
foo*.
With some indexes it is possible to use AND/OR/NOT/etc/
associations. It is possible to modify those associations, for
example to use French associations: ET/OU/PAS/NON/etc. To do that,
special query parsing should be added to the tool.
It is also possible to drop left truncation feature.
TODO: explain why it is interesting
TODO: explain how