Query syntax

Queries can be defined by the following components (for more details, see Grammar).

Atoms

Atoms represent the basic components of each query (and can be queries on their own).

Type

Syntax

Description

Simple words

word without spaces

A normal word without special characters. Evaluated to true if the word is present in the search scope.

Word with wildcards

See Wildcards syntax

See Wildcards descriptions.

Expression

“first second third …”

A list of words separated by white spaces (words cannot contain wildcards). Evaluated to true if the exact expression if found the search scope.

Proximity

expression ~ distance

Expression ~ distance (e.g. “hello world” ~ 2). Evaluated to true if all the words are present in the search scope (in the same order) separated by at most distance words.

Warning

Note that all atoms are case insensitive and that’s intended.

Logical operators

Operator

Syntax

Description

AND

left AND right

Logical and operator. Both conditions must be satisfied.

OR

left OR right

Logical or operator. At least one condition must be satisfied.

NOT

left NOT right

Exclusion operator. Equivalent to boolean (left AND NOT right). To be evaluated to true, left must be true and right to false.

Search scopes

Search Scope

Keyword

Syntax

Description

Title

intitle

intitle: subquery

Subquery will be searched only in title.

Content

incontent

incontent: subquery

Subquery will be searched only in document content.

Global

subquery

Default scope. If nothing is specified, the subquery will be searched in both content and title.

Note

Search scope keywords are case insensitive (i.e. “INTITLE:”, “Intitle:”, and “intitle:” are equivalent).

Note

Another search scope (begin) will be implemented soon and will look up for keyword only in the beginning of document content.

Wildcards

Currently, there’s only two wildcards implemented, and their behaviors are very different from their equivalent in Regex.

Wildcard

Syntax

Description

*

word *

Will match everything or nothing. E.g. hell* would match hell, hello, helloo, and hellfires.

?

word ?

Will match one character or nothing. E.g. hell? would match hell, hello but not helloo neither hellfires

Priorities

Priorities are defined in this order (from highest to lower):

  • Parenthesis

  • Expressions & Proximities

  • Scoped queries

  • Logical operators

Examples:

  • intitle:hello AND world is equivalent to (intitle:(hello) AND world)

  • hello OR short AND fake is equivalent to ((hello OR short) AND fake)