]> git.notmuchmail.org Git - notmuch/commitdiff
lib: add mid: as a synonym for id:
authorDavid Bremner <david@tethera.net>
Mon, 27 Feb 2017 02:34:21 +0000 (22:34 -0400)
committerDavid Bremner <david@tethera.net>
Fri, 3 Mar 2017 21:46:48 +0000 (17:46 -0400)
mid: is the url scheme suggested by URL 2392. We also plan to
introduce more flexible searches for mid: than are possible with
id: (in order not to break assumptions about the special behaviour of
id:, e.g. identifying at most one message).

lib/database.cc
test/T080-search.sh

index 573c9fe070a5abb41369f19cfbf50cdf2538cde1..b7fc53ee18734d801201f73d841765cae8a89578 100644 (file)
@@ -262,6 +262,7 @@ prefix_t prefix_table[] = {
     { "tag",                   "K",            NOTMUCH_FIELD_EXTERNAL },
     { "is",                    "K",            NOTMUCH_FIELD_EXTERNAL },
     { "id",                    "Q",            NOTMUCH_FIELD_EXTERNAL },
     { "tag",                   "K",            NOTMUCH_FIELD_EXTERNAL },
     { "is",                    "K",            NOTMUCH_FIELD_EXTERNAL },
     { "id",                    "Q",            NOTMUCH_FIELD_EXTERNAL },
+    { "mid",                   "Q",            NOTMUCH_FIELD_EXTERNAL },
     { "path",                  "P",            NOTMUCH_FIELD_EXTERNAL },
     { "property",              "XPROPERTY",    NOTMUCH_FIELD_EXTERNAL },
     /*
     { "path",                  "P",            NOTMUCH_FIELD_EXTERNAL },
     { "property",              "XPROPERTY",    NOTMUCH_FIELD_EXTERNAL },
     /*
index 5e8b20ce1657869d6a9d6c1d0039f3764f48d575..6149da93f6f913670439d6ecf80e1b788a90b70b 100755 (executable)
@@ -34,6 +34,11 @@ add_message '[subject]="search by id"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"
 output=$(notmuch search id:${gen_msg_id} | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by id (inbox unread)"
 
 output=$(notmuch search id:${gen_msg_id} | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by id (inbox unread)"
 
+test_begin_subtest "Search by mid:"
+add_message '[subject]="search by mid"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
+output=$(notmuch search mid:${gen_msg_id} | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by mid (inbox unread)"
+
 test_begin_subtest "Search by tag:"
 add_message '[subject]="search by tag"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
 notmuch tag +searchbytag id:${gen_msg_id}
 test_begin_subtest "Search by tag:"
 add_message '[subject]="search by tag"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
 notmuch tag +searchbytag id:${gen_msg_id}
@@ -127,6 +132,7 @@ thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by to (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; subjectsearchtest (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; utf8-sübjéct (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by id (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; subjectsearchtest (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; utf8-sübjéct (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by id (inbox unread)
+thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by mid (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by tag (inbox searchbytag unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by thread (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; body search (phrase) (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by tag (inbox searchbytag unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by thread (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; body search (phrase) (inbox unread)