Hi gregor! On Thu, 27 Mar 2025, gregor herrmann wrote:
> > I did some early tests with notmuch-addrlookup and noted some (for > > me) unexpected effects like looking up "example" returns only two > > lines (with "example.org"), while looking up "example.com" returns > > 15 lines with the same test database and config. Okay I did a deeper dive now in an defined environment. I started with a maildir which contains mails From: the following addresses: First1 Family1 <f...@example.com> f...@example.com (First2 Family2) <f...@example.com> (First3 Family3) "First4 Family4" <f...@example.com> f...@example.com ("First5 Family5") <f...@example.com> ("First6 Family6") <f...@example.com> f...@example.com f...@example.com () "" <fo...@example.com> Short11 <fo...@example.com> "Short12" <fo...@example.com> fo...@example.com (Short13) fo...@example.com ("Short14") "Last15, First15" <fo...@example.com> Other Other <ot...@example.net> (generated by my lbdb testsuite, a tar is attached). Then I generate an alt-config for notmuch using notmuch --config=alt-config setup with path= pointing to this maildir. After this I built the database using $ env NOTMUCH_CONFIG=alt-config notmuch new Here's a list, what I hoped to get as output when searching for example.com (ignore the formatting in columns and order of results at the moment, just the mail address and common name are relevant here): f...@example.com First1 Family1 f...@example.com First2 Family2 f...@example.com Frist3 Family3 f...@example.com First4 Family4 f...@example.com First5 Family5 f...@example.com First6 Family6 f...@example.com foo7 f...@example.com foo8 f...@example.com foo9 fo...@example.com foo10 fo...@example.com Short11 fo...@example.com Short12 fo...@example.com Short13 fo...@example.com Short14 fo...@example.com Last15, First15 From testing with maildir-utils (mu) I know that the combined syntax with "<>" and "()" (foo4 and foo6) seems to be hard to understand, but usually either "<>" (foo1, foo4, foo15) or "()" (foo2, foo5) is used, so this syntax should at least be understood correctly. Let's see what "notmuch address" and "notmuch-addrlookup" will deliver here: First notmuch itself (for debbg $ env NOTMUCH_CONFIG=alt-config notmuch address --format=json example.com \ | jq -r '.[] | "\(.address)\t\(.name)"' (for debugging purpose I used the json format and jq to format it and manually sorted it afterwards): f...@example.com First1 Family1 f...@example.com First2 Family2 f...@example.com f...@example.com First4 Family4 f...@example.com First5 Family5 f...@example.com f...@example.com f...@example.com f...@example.com fo...@example.com fo...@example.com Short11 fo...@example.com Short12 fo...@example.com Short13 fo...@example.com Short14 fo...@example.com Last15, First15 That doesn't look too bad. Like with mu foo3 and foo6 don't have my preferred common-name. And if there is no common-name given, I'd prefer to have the local part of the mail address as common-name, but this can be fixed with some lines of code. In comparison to this I tried out notmuch-addrlookup: $ env NOTMUCH_CONFIG=alt-config notmuch-addrlookup --format=mutt example.com (with manual sorting afterwards) Searching database ... 15 matching entries: f...@example.com First1 Family1 f...@example.com f...@example.com <f...@example.com> <f...@example.com> f...@example.com "First4 Family4" f...@example.com f...@example.com <f...@example.com> <f...@example.com> <f...@example.com> <f...@example.com> fo...@example.com "" fo...@example.com Short11 fo...@example.com "Short12" fo...@example.com fo...@example.com fo...@example.com fo...@example.com fo...@example.com "Last15, First15" That doesn't look good to me: - Why do foo3, foo6, foo7 have "<>" around the mail address? - foo2 and foo5 completely lost the common name (seems that the old "()" syntax of the common name is not supported). The additional "<>" can be removed but restoring the missing common-names isn't possible. Maybe this needs some bug report against notmuch-addrlookup (maybe this has to do with https://github.com/aperezdc/notmuch-addrlookup-c/issues/31, which looks similar). So at the moment I tend to base a m_notmuch module on "notmuch address". For a long time I thought that "notmuch address" only searches for addresses but not for common names, but I just found out, that it seems to do some exact match. Searching for "first1 family1" gives an result as well as "first1" does, while searching for "first" does not match at all. Seems that I should add some wildcards (like "*first*") to get what I expected... And it also seems to be necessary that I dive deeper into notmuch-search-terms(7) and notmuch-address(1), since $ env NOTMUCH_CONFIG=alt-config notmuch address org returns my complete database, but none of the addresses contains "org". Ah, that seems to be the result of all mails being sent "To: m...@example.org" (crazy that the m...@example.org itself isn't in the output of this command). That's also not what I expected. I tried this with my real inbox searching for "roland" and got tons of output (without a match to "roland"), which are mails send by me to someone else who is listed in the output. Oh hell, either I don't understand how to call "notmuch address" correctly or it just does not do what I expect it to do. That brings me back to notmuch-addresslookup again, which now behaves more intuitive to me (except the added "<>" and the missing common names in "()", which nowadays seems to be quite uncommon). This is just a little status information (for you and as reference for myself) to show, that this bug report isn't forgotten. Greetings Roland
maildir.tar.gz
Description: application/tar-gz
signature.asc
Description: PGP signature