unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* searching for a message by path
@ 2024-09-20 17:52 Frederick Eaton
  2024-09-21  0:25 ` Pengji Zhang
  0 siblings, 1 reply; 16+ messages in thread
From: Frederick Eaton @ 2024-09-20 17:52 UTC (permalink / raw)
  To: notmuch

Dear Notmuch,

I am trying to figure out how to adapt a script I wrote for filtering messages, to apply notmuch tags to each message. A difficulty is that the messages are already in the Notmuch database, because another tool has delivered them to a maildir and run "notmuch new".

Now, Notmuch can provide me with the paths of all the new (unfiltered) messages, which I can give to my script. The question I have is, once the filter is done, how can the script tell Notmuch which message to apply the tags to?

I've tentatively concluded that the best way to locate each message in the Notmuch database is to extract the Message-ID and search for it with "id:"? But the FAQ says that multiple messages can have the same Message-ID (and some spam messages don't have one at all).

If I could access the message using the filename that the script is processing, it would seem slightly more reliable. It seems like there should be some way to allow a Notmuch database entry to be accessed directly by filename, without even creating a Notmuch-style search query containing that filename, but rather by passing the filename as a command-line argument to "notmuch". It would be nice not to have to worry about quoting and unquoting.

When I try to search for a message using "path:", nothing seems to work.

     $ notmuch show id:"enwiki.66eda276579298.42329355@en.wikipedia.org" | grep filename
     message{ id:enwiki.66eda276579298.42329355@en.wikipedia.org depth:0 match:1 excluded:0 filename:/home/me/mail/notmuch//gmail-me/mail/cur/1921042a466e0b3b:2,
     $ notmuch search id:"enwiki.66eda276579298.42329355@en.wikipedia.org"
     thread:000000000003a7a9 33 mins. ago [1/1] Wikipedia; Wikipedia page SpaceX Raptor has been changed by Canterbury Tail (important inbox unread updates)
     $ notmuch search path:"/home/me/mail/notmuch//gmail-me/mail/cur/1921042a466e0b3b:2,"
     notmuch search: A Xapian exception occurred
     A Xapian exception occurred parsing query: unmatched regex delimiter in '/home/me/mail/notmuch//gmail-me/mail/cur/1921042a466e0b3b:2,'
     Query string was: path:/home/me/mail/notmuch//gmail-me/mail/cur/1921042a466e0b3b:2,
     [1]$ notmuch search path:"\/home\/me\/mail\/notmuch\/gmail-me\/mail\/cur\/1921042a466e0b3b:2,"
     $ notmuch search path:"\/home\/me\/mail\/notmuch\/\/gmail-me\/mail\/cur\/1921042a466e0b3b:2,"
     $ notmuch search path:"*1921042a466e0b3b*"
     $ notmuch search path:".*1921042a466e0b3b.*"
     $ notmuch search path:"/.*1921042a466e0b3b.*/"
     $ notmuch search path:"notmuch/gmail-me/mail/cur/1921042a466e0b3b:2,"
     $ notmuch search path:"notmuch//gmail-me/mail/cur/1921042a466e0b3b:2,"
     $ notmuch search path:"gmail-me/mail/cur/1921042a466e0b3b:2,"
     $ notmuch search path:"mail/cur/1921042a466e0b3b:2,"
     $ notmuch search path:"cur/1921042a466e0b3b:2,"
     $ notmuch search path:"/\/home\/me\/mail\/notmuch\/gmail-me\/mail\/cur\/1921042a466e0b3b:2,/"

There were no results for any of the "path:" searches, although the "id:" search worked. I am using version 0.32.2 and can update if this may be related to a bug that was fixed in the past few years.

I am not subscribed so please kindly Cc me if you have any ideas.

Thank you,

Frederick

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-10-14 10:58 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-20 17:52 searching for a message by path Frederick Eaton
2024-09-21  0:25 ` Pengji Zhang
2024-09-21  3:23   ` Frederick Eaton
2024-09-21  9:01     ` Pengji Zhang
2024-09-21  9:38     ` Michael J Gruber
2024-09-21 10:44     ` Gregor Zattler
2024-09-21 16:24     ` Panayotis Manganaris
2024-09-21 17:30       ` Teemu Likonen
2024-09-23 22:14         ` Panayotis Manganaris
2024-09-24 13:00           ` David Bremner
2024-09-24  9:09       ` Michael J Gruber
2024-09-28  2:56         ` Frederick Eaton
2024-09-29 12:08           ` David Bremner
2024-10-12 22:59             ` David Bremner
2024-10-14  6:50               ` Michael J Gruber
2024-10-14 10:58                 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).