Re: v3 of message properties patches
Tomi Ollila writes: > > I am happy with merging the series, just amend the sepErates > (and possibly spcs->tab after $(dir)/string-map.c in -3-) > > I looked through the code and did not see anything that should broke > anything. As Daniel has been using it I can slack off from testing it myself > :D > > Tomi I have merged this series, amended as follows: diff --git a/doc/man1/notmuch-dump.rst b/doc/man1/notmuch-dump.rst index 29964da..5857027 100644 --- a/doc/man1/notmuch-dump.rst +++ b/doc/man1/notmuch-dump.rst @@ -84,7 +84,7 @@ Supported options for **dump** include **properties** Output per-message (key,value) metadata. Each line starts - with "#= ", followed by a message id, and a space seperated + with "#= ", followed by a message id, and a space separated list of key=value pairs. pair. Ids, keys and values are hex encoded if needed. diff --git a/doc/man1/notmuch-restore.rst b/doc/man1/notmuch-restore.rst index ebdb3ff..c681fa2 100644 --- a/doc/man1/notmuch-restore.rst +++ b/doc/man1/notmuch-restore.rst @@ -63,7 +63,7 @@ Supported options for **restore** include **properties** Output per-message (key,value) metadata. Each line starts - with "#= ", followed by a message id, and a space seperated + with "#= ", followed by a message id, and a space separated list of key=value pairs. pair. Ids, keys and values are hex encoded if needed. diff --git a/doc/man7/notmuch-search-terms.rst b/doc/man7/notmuch-search-terms.rst index a85d94b..de93d73 100644 --- a/doc/man7/notmuch-search-terms.rst +++ b/doc/man7/notmuch-search-terms.rst @@ -58,7 +58,7 @@ indicate user-supplied values): - query: -- has:= +- property:= The **from:** prefix is used to match the name or address of the sender of an email message. @@ -141,7 +141,7 @@ queries added with **notmuch-config(1)**. Named queries are only available if notmuch is built with **Xapian Field Processors** (see below). -The **has:** prefix searches for messages with a particular +The **property:** prefix searches for messages with a particular = property pair. Properties are used internally by notmuch (and extensions) to add metadata to messages. A given key can be present on a given message with several different values. @@ -224,7 +224,7 @@ exact matches like "tag:inbox" or **probabilistic**, supporting a more flexible Boolean - **tag:**, **id:**, **thread:**, **folder:**, **path:**, **has:** + **tag:**, **id:**, **thread:**, **folder:**, **path:**, **property:** Probabilistic **from:**, **to:**, **subject:**, **attachment:**, **mimetype:** diff --git a/lib/Makefile.local b/lib/Makefile.local index c012ed1..3d1030a 100644 --- a/lib/Makefile.local +++ b/lib/Makefile.local @@ -40,7 +40,7 @@ libnotmuch_c_srcs = \ $(dir)/messages.c \ $(dir)/sha1.c \ $(dir)/built-with.c \ - $(dir)/string-map.c\ + $(dir)/string-map.c \ $(dir)/tags.c libnotmuch_cxx_srcs = \ diff --git a/lib/database.cc b/lib/database.cc index d3e2e0e..392e8b2 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -97,7 +97,7 @@ typedef struct { * STRING is the name of a file within that * directory for this mail message. * - * has: Has a property with key=value + * property: Has a property with key=value * FIXME: if no = is present, should match on any value * *A mail document also has four values: @@ -254,7 +254,6 @@ static prefix_t BOOLEAN_PREFIX_INTERNAL[] = { { "directory", "XDIRECTORY" }, { "file-direntry", "XFDIRENTRY" }, { "directory-direntry","XDDIRENTRY" }, -{ "property", "XPROPERTY" }, }; static prefix_t BOOLEAN_PREFIX_EXTERNAL[] = { @@ -263,7 +262,7 @@ static prefix_t BOOLEAN_PREFIX_EXTERNAL[] = { { "is","K" }, { "id","Q" }, { "path", "P" }, -{ "has", "XPROPERTY" }, +{ "property", "XPROPERTY" }, /* * Unconditionally add ':' to reduce potential ambiguity with * overlapping prefixes and/or terms that start with capital diff --git a/test/T610-message-property.sh b/test/T610-message-property.sh index ee7910b..65ff19d 100755 --- a/test/T610-message-property.sh +++ b/test/T610-message-property.sh @@ -237,12 +237,12 @@ notmuch restore < BEFORE2 notmuch dump | grep '^#=' > OUTPUT test_expect_equal_file PROPERTIES OUTPUT -test_begin_subtest "test 'has:' queries: empty" -notmuch search has:testkey1=charles > OUTPUT +test_begin_subtest "test 'property:' queries: empty" +notmuch search property:testkey1=charles > OUTPUT test_expect_equal_file /dev/null OUTPUT -test_begin_subtest "test 'has:' queries: single message" -notmuch search --output=messages has:testkey1=alice > OUTPUT +te
Re: v3 of message properties patches
On Wed, Sep 21 2016, David Bremner wrote: > Daniel Kahn Gillmor writes: > >> I've been running this series of patches since shortly after they were >> released. They work for me, and they're a critical feature to enable >> the cleartext index series i've been trying to land. > > OK, that's certainly more testing and API evaluation than most series > get. I'd still like someone other than me to sanity check the code > itself, and the design decisions that hard to change later, namely > changes to the database format and the dump-restore format. And of > course the main reason we want code review is for to find the issues > that I am not aware of. Tomi, I know you've read the code at some level, > are you happy with merging the series? I am happy with merging the series, just amend the sepErates (and possibly spcs->tab after $(dir)/string-map.c in -3-) I looked through the code and did not see anything that should broke anything. As Daniel has been using it I can slack off from testing it myself :D Tomi > >> >> As i've been maintaining them against the master branch, they've >> diverged slightly from the series here. I'd be happy to send the >> updated revisions here if folks want them, but there are no substantive >> changes. > > I can confirm that's just a rebase against master of what I have. ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: v3 of message properties patches
Daniel Kahn Gillmor writes: > I've been running this series of patches since shortly after they were > released. They work for me, and they're a critical feature to enable > the cleartext index series i've been trying to land. OK, that's certainly more testing and API evaluation than most series get. I'd still like someone other than me to sanity check the code itself, and the design decisions that hard to change later, namely changes to the database format and the dump-restore format. And of course the main reason we want code review is for to find the issues that I am not aware of. Tomi, I know you've read the code at some level, are you happy with merging the series? > > As i've been maintaining them against the master branch, they've > diverged slightly from the series here. I'd be happy to send the > updated revisions here if folks want them, but there are no substantive > changes. I can confirm that's just a rebase against master of what I have. ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: v3 of message properties patches
On Sat 2016-08-06 09:52:30 -0400, David Bremner wrote: > This obsoletes > > id:1470184228-12517-1-git-send-email-da...@tethera.net > > In particular it fixes the compile errors (boo), and adds dkg's > has: queries, with minimal doc and tests. I've been running this series of patches since shortly after they were released. They work for me, and they're a critical feature to enable the cleartext index series i've been trying to land. I'd like to nominate them for inclusion in 0.23 (if we can get them pushed to master, i might even nominate my cleartext index series for 0.23 as well). As i've been maintaining them against the master branch, they've diverged slightly from the series here. I'd be happy to send the updated revisions here if folks want them, but there are no substantive changes. You can see the current branch at proprties-v3 (commit ID 9d98707a90c0fcd0eb7b0671edb7d9e39aff551f) on git://lair.fifthhorseman.net/~dkg/notmuch Regards, --dkg signature.asc Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
v3 of message properties patches
This obsoletes id:1470184228-12517-1-git-send-email-da...@tethera.net In particular it fixes the compile errors (boo), and adds dkg's has: queries, with minimal doc and tests. interdiff follows: diff --git a/doc/man7/notmuch-search-terms.rst b/doc/man7/notmuch-search-terms.rst index 075f88c..86d02ee 100644 --- a/doc/man7/notmuch-search-terms.rst +++ b/doc/man7/notmuch-search-terms.rst @@ -58,6 +58,8 @@ indicate user-supplied values): - query: +- has:= + The **from:** prefix is used to match the name or address of the sender of an email message. @@ -139,6 +141,11 @@ queries added with **notmuch-config(1)**. Named queries are only available if notmuch is built with **Xapian Field Processors** (see below). +The **has:** prefix searches for messages with a particular += property pair. Properties are used internally by notmuch +(and extensions) to add metadata to messages. A given key can be +present on a given message with several different values. + Operators - @@ -217,7 +224,7 @@ exact matches like "tag:inbox" or **probabilistic**, supporting a more flexible Boolean - **tag:**, **id:**, **thread:**, **folder:**, **path:** + **tag:**, **id:**, **thread:**, **folder:**, **path:**, **has** Probabilistic **from:**, **to:**, **subject:**, **attachment:**, **mimetype:** diff --git a/lib/database.cc b/lib/database.cc index 3a741f0..3bdbd07 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -97,6 +97,9 @@ typedef struct { * STRING is the name of a file within that * directory for this mail message. * + * has: Has a property with key=value + * FIXME: if no = is present, should match on any value + * *A mail document also has four values: * * TIMESTAMP: The time_t value corresponding to the message's @@ -260,6 +263,7 @@ static prefix_t BOOLEAN_PREFIX_EXTERNAL[] = { { "is","K" }, { "id","Q" }, { "path", "P" }, +{ "has", "XPROPERTY" }, /* * Without the ":", since this is a multi-letter prefix, Xapian * will add a colon itself if the first letter of the path is diff --git a/notmuch-restore.c b/notmuch-restore.c index 3cd8a40..d6429ef 100644 --- a/notmuch-restore.c +++ b/notmuch-restore.c @@ -83,7 +83,7 @@ process_properties_line (notmuch_database_t *notmuch, const char* line) goto DONE; if (print_status_database ("notmuch restore", notmuch, - notmuch_message_remove_all_properties (message))) + notmuch_message_remove_all_properties (message, NULL))) goto DONE; tok = id_p + id_len; diff --git a/test/T610-message-property.sh b/test/T610-message-property.sh index 8952eb7..ee7910b 100755 --- a/test/T610-message-property.sh +++ b/test/T610-message-property.sh @@ -91,7 +91,7 @@ test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "notmuch_message_remove_all_properties" cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} -EXPECT0(notmuch_message_remove_all_properties (message)); +EXPECT0(notmuch_message_remove_all_properties (message, NULL)); print_properties (message, "", FALSE); EOF cat <<'EOF' >EXPECTED @@ -237,4 +237,15 @@ notmuch restore < BEFORE2 notmuch dump | grep '^#=' > OUTPUT test_expect_equal_file PROPERTIES OUTPUT +test_begin_subtest "test 'has:' queries: empty" +notmuch search has:testkey1=charles > OUTPUT +test_expect_equal_file /dev/null OUTPUT + +test_begin_subtest "test 'has:' queries: single message" +notmuch search --output=messages has:testkey1=alice > OUTPUT +cat