]> git.cworth.org Git - notmuch/blob - doc/man7/notmuch-sexp-queries.rst
lib/parse-sexp: stem unquoted atoms
[notmuch] / doc / man7 / notmuch-sexp-queries.rst
1 .. _notmuch-sexp-queries(7):
2
3 ====================
4 notmuch-sexp-queries
5 ====================
6
7 SYNOPSIS
8 ========
9
10 **notmuch** **search** ``--query=sexp`` '(and (to santa) (date december))'
11
12 DESCRIPTION
13 ===========
14
15
16 S-EXPRESSIONS
17 -------------
18
19 An *s-expression* is either an atom, or list of whitespace delimited
20 s-expressions inside parentheses. Atoms are either
21
22 *basic value*
23     A basic value is an unquoted string containing no whitespace, double quotes, or
24     parentheses.
25
26 *quoted string*
27     Double quotes (") delimit strings possibly containing whitespace
28     or parentheses. These can contain double quote characters by
29     escaping with backslash. E.g. ``"this is a quote \""``.
30
31 S-EXPRESSION QUERIES
32 --------------------
33
34 An s-expression query is either an atom, the empty list, or a
35 *compound query* consisting of a prefix atom (first element) defining
36 a *field*, *logical operation*, or *modifier*, and 0 or more
37 subqueries.
38
39 ``*``
40 ``()``
41     The empty list matches all messages
42
43 *term*
44     Match all messages containing *term*, possibly after
45     stemming or phase splitting. For discussion of stemming in
46     notmuch see :any:`notmuch-search-terms(7)`. Stemming only applies
47     to unquoted terms (basic values) in s-expression queries.
48
49 ``(`` *field* |q1| |q2| ... |qn| ``)``
50     Restrict the queries |q1| to |qn| to *field*, and combine with *and*
51     (for most fields) or *or*. See :any:`fields` for more information.
52
53 ``(`` *operator* |q1| |q2| ... |qn| ``)``
54     Combine queries |q1| to |qn|. See :any:`operators` for more information.
55
56 ``(`` *modifier* |q1| |q2| ... |qn| ``)``
57     Combine queries |q1| to |qn|, and reinterpret the result (e.g. as a regular expression).
58     See :any:`modifiers` for more information.
59
60 .. _fields:
61
62 FIELDS
63 ``````
64
65 .. _operators:
66
67 OPERATORS
68 `````````
69
70 .. _modifiers:
71
72 MODIFIERS
73 `````````
74
75 EXAMPLES
76 ========
77
78 ``Wizard``
79     Match all messages containing the word "wizard", ignoring case.
80
81 ``added``
82     Match all messages containing "added", but also those containing "add", "additional",
83     "Additional", "adds", etc... via stemming.
84
85 .. |q1| replace:: :math:`q_1`
86 .. |q2| replace:: :math:`q_2`
87 .. |qn| replace:: :math:`q_n`