diff options
| author | David Bremner <david@tethera.net> | 2017-12-25 21:03:05 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2018-05-07 08:42:53 -0300 |
| commit | 5ad39ebf75eb85263e4b64f21e07ec02194f9573 (patch) | |
| tree | cd888e186b3d84c8819b94d891ff8c10d83d0498 /test | |
| parent | 3a747e714c3e99a725619d09d832b9ac683733fe (diff) | |
lib: add thread subqueries.
This change allows queries of the form
thread:{from:me} and thread:{from:jian} and not thread:{from:dave}
This is still somewhat brute-force, but it's a big improvement over
both the shell script solution and the previous proposal [1], because it
does not build the whole thread structure just generate a
query. A further potential optimization is to replace the calls to
notmuch with more specialized Xapian code; in particular it's not
likely that reading all of the message metadata is a win here.
[1]: id:20170820213240.20526-1-david@tethera.net
Diffstat (limited to 'test')
| -rwxr-xr-x | test/T585-thread-subquery.sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/T585-thread-subquery.sh b/test/T585-thread-subquery.sh new file mode 100755 index 00000000..71ced149 --- /dev/null +++ b/test/T585-thread-subquery.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2018 David Bremner +# + +test_description='test of searching by using thread subqueries' + +. $(dirname "$0")/test-lib.sh || exit 1 + +add_email_corpus + +test_begin_subtest "Basic query that matches no messages" +count=$(notmuch count from:keithp and to:keithp) +test_expect_equal 0 "$count" + +test_begin_subtest "Same query against threads" +notmuch search thread:{from:keithp} and thread:{to:keithp} | notmuch_search_sanitize > OUTPUT +cat<<EOF > EXPECTED +thread:XXX 2009-11-18 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth; [notmuch] Working with Maildir storage? (inbox signed unread) +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "Mix thread and non-threads query" +notmuch search thread:{from:keithp} and to:keithp | notmuch_search_sanitize > OUTPUT +cat<<EOF > EXPECTED +thread:XXX 2009-11-18 [1/7] Lars Kellogg-Stedman| Mikhail Gusarov, Keith Packard, Carl Worth; [notmuch] Working with Maildir storage? (inbox signed unread) +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "Compound subquery" +notmuch search 'thread:"{from:keithp and date:2009}" and thread:{to:keithp}' | notmuch_search_sanitize > OUTPUT +cat<<EOF > EXPECTED +thread:XXX 2009-11-18 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth; [notmuch] Working with Maildir storage? (inbox signed unread) +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "Syntax/quoting error in subquery" +notmuch search 'thread:{from:keithp and date:2009} and thread:{to:keithp}' 1>OUTPUT 2>&1 +cat<<EOF > EXPECTED +notmuch search: A Xapian exception occurred +A Xapian exception occurred parsing query: missing } in '{from:keithp' +Query string was: thread:{from:keithp and date:2009} and thread:{to:keithp} +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_done |
