WIP: fixes for implicit operators and subqueries

2019-08-31 Thread David Bremner
This obsoletes the patches discussed at id:871rx38q8y@tethera.net and id:20190821114126.23540-2-da...@tethera.net I think I still have a spelling error in the commit message that Tomi caught, and I need to update notmuch-search-terms(7). Before I do that, please have a look at the

[WIP2 5/5] lib: special case parenthesized subqueries in regex fields

2019-08-31 Thread David Bremner
These should not be treated as phrase searches. Due to the problem outlined in [1] it is not possible to use a query string subject:(foo bar) but at least with this fix subject:"(foo bar)" expands to subject:foo OP subject:bar, which is more useful than another way to type a p

[WIP2 4/5] test: add known broken tests for parenthesized subqueries

2019-08-31 Thread David Bremner
The quoting around the () is needed because of our choice of using boolean fields at the Xapian level, and [1] [1]: https://trac.xapian.org/ticket/795 --- test/T650-regexp-query.sh | 24 1 file changed, 24 insertions(+) diff --git a/test/T650-regexp-query.sh b/test/T650-

[WIP2 3/5] lib: introduce N_F_GROUP and use it to fix implicit AND for from:

2019-08-31 Thread David Bremner
We try to match the rules discussed in the last commit: probabilistic fields are implicit AND, and boolean fields are implicit OR, unless they can be repeated (tag: being the prominent example of a repeating, i.e. non-exclusive field). --- lib/database-private.h | 1 + lib/database.cc

[WIP2 1/5] lib: rename _debug_query to _notmuch_query_debug, make extern

2019-08-31 Thread David Bremner
This makes it available for use within the field processors. --- lib/notmuch-private.h | 5 + lib/query.cc | 10 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h index 9bdb68ab..f0657147 100644 --- a/lib/notmuch-

[WIP2 2/5] test: add known broken tests for implicit operators

2019-08-31 Thread David Bremner
Given we want 'a b' to parse as 'a AND b', then for any probabilistic (free text) prefix foo:, we should also get 'foo:a foo:b' expanding to 'foo:a AND foo:b'. Currently this is not true due to the implimentation of regex fields. On the other hand for "exclusive" (i.e. one per message) fields, we w