From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id OHi8EKHADGe/wAAAqHPOHw:P1 (envelope-from ) for ; Mon, 14 Oct 2024 06:56:33 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id OHi8EKHADGe/wAAAqHPOHw (envelope-from ) for ; Mon, 14 Oct 2024 08:56:33 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=JpX1+xCH; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1728888993; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=6SZdml6GQI6CQM+0+UW3wOC332hX3nCW7zccLuAgP+0=; b=NISz9ydzfo6D9yeHv/Hn8oOEPYT2RFxCjR0aXmso72Crd8uxfJclIjLtyp16T7lj0giSuE qjBm26TqqLptCPTGCTVevoBp3AC0uDJNLMQH75fsUMBK0y69nUcOtYpB2od8VEtmhlkPgC xrsN4UFYxTxGsvsDcCSZ2jtrnS3jYMLdg1eGIPIiJnsOZPVcqZQg+dc7q0a8hRzPOJ1TOf c+L2cwom+dVpaHuITcufAZIrbUPrOuRdOGcQ3gzvRduezgy/bcIax7GGT1W3xk0/uzomR9 rWMpLuGOiIZBpQ0qfouyoauiT2j7I9AewnBqzRGW/6o2A5aKzzgWFWjUUdBKgA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=JpX1+xCH; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1728888993; a=rsa-sha256; cv=none; b=OUPp4cwyEAlUX6zALGPD89IJQs5kq0Y6+McbUmDfBn0HvcoylE50H9BhyKJruWmdkJ0d2z JCCiAUFj2k0Y7LMHZmeeiLHieDfByHWTPI9nDBxYdK9UMrWAr5Xu6y/nMDy9Z9XiPpXeHK lC13MPDDyJOr2dsMBfpBsDR6fB55l8v0NCzUxu9cb4I3pJqSiH1vMEHsSE8tZogdeslCdQ WkxmvSSxULUswMgCr/REteWsJiv7qlUKnCgfBnKSlF51dHnCRmDbTAcDZqZ1uOpeMWaXfK eygS7sHSY85Xes11f/8Jb/afD1u1WgdvM5MrZz813cieUHuKOP/lyjTjRAMU4Q== Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 794CF44B41 for ; Mon, 14 Oct 2024 08:56:32 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 441055E51B; Mon, 14 Oct 2024 06:50:39 +0000 (UTC) Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by mail.notmuchmail.org (Postfix) with ESMTPS id 481955E50F for ; Mon, 14 Oct 2024 06:50:36 +0000 (UTC) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-539e1543ab8so3366430e87.2 for ; Sun, 13 Oct 2024 23:50:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728888636; x=1729493436; darn=notmuchmail.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=WFWSnpKiQHedLk3EvySP8J2eZXYUNt5XlvQWSZnrZOc=; b=JpX1+xCHFwC1MKC8OAQCeSAEMn2fqKGh4wqkgj7gSL2BOxbFL0s6ZvpYawpkYPnJF4 OCOSMn0vTxnlReX06gZCDLX5rlyDTBDbUfvzeTN0P4jWetj03XAnqRGXiIZDhyHR85nk T8mBsb0btxSS4OOBFF7TIE74Bisf0rYUr2y4JchAgky6qq65yhoH13+GPVh/7nEnUwEq GjtinLoEJDELf8JYJL5UhXxodcdfvgDmBvKO8fOKbznMpHbnIW2UahDnYXfUOSv5d5Dk iW/5P+IWEPbDlN3Fw1ovFNvfLHNsP7QqPDbbyHsvdqAc6d2C83uDxCR92xwmi5hHIttE Q1pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728888636; x=1729493436; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WFWSnpKiQHedLk3EvySP8J2eZXYUNt5XlvQWSZnrZOc=; b=qUvQhpA+Jo2+OmRDBoEbQyaYHWPoD3NJERDfWTSQfDndfQK5eu7zX20jHxkltk11WI 6PEUY059tybpYV6otlQ3BSeoVuQYvtSr32AiPSLgkk6DLjLJnukwzVfpu2m2vKJf4iMh e8zoVSwZwcqRpv/jgd5qDB89sCgJOxn3EuNlafcjtJXB8olaiRtBq7shOy0baXoTTOk4 t3JsmqhWIlM6ut4V9dC5r/lCtHeW101RhjEhQVc4MVWEu5kifA+yWiL8UWYIpVSyLG8m x6CcXom4Jj1cgmTe1WBzOwV/tkqlepHEx5FnP8MUfq90rVP+7OIZh5aGaHnk2UGBcfTu tppA== X-Forwarded-Encrypted: i=1; AJvYcCXCtAkNX9mILLRVSOSwLKsEnIIFopbofREiuFE66om/gJOx8cHLtJ0yyY1WgD20a5bPtgd7TYEQ@notmuchmail.org X-Gm-Message-State: AOJu0YyQRjWBepkpqUddCWnzbRpxzYK0nPLZIPzYvqztgUYnTAaL9dzW yBxRkVHdvcMFz8qXKJVvP3h+8+2avMOiMOflyYG0c3Jo42/mz+RGfCLTBFYMlhuDmH40Yskl6Ld UzrKq1nEOX+qRU+HRj4h1nb1WAtQ= X-Google-Smtp-Source: AGHT+IFdYlBu1r74kYDrRshHgFK/9eeW4SrjnT7w43ifNXUBAsYt21S7UhU3MTAdPy/fwWMhqLxZjHcNtPZ/PKZjaRo= X-Received: by 2002:a05:6512:2509:b0:539:f10b:ff97 with SMTP id 2adb3069b0e04-539f10c010amr1204655e87.49.1728888635423; Sun, 13 Oct 2024 23:50:35 -0700 (PDT) MIME-Version: 1.0 References: <20240928025630.km2tcgjgt3xub4jo@localhost> <87wmiur7aq.fsf@tethera.net> <874j5hdj1a.fsf@tethera.net> In-Reply-To: <874j5hdj1a.fsf@tethera.net> From: Michael J Gruber Date: Mon, 14 Oct 2024 08:50:23 +0200 Message-ID: Subject: Re: searching for a message by path To: David Bremner Message-ID-Hash: IEB7OHTOIPPDMNOV52EAOFKP6OYFKVFU X-Message-ID-Hash: IEB7OHTOIPPDMNOV52EAOFKP6OYFKVFU X-MailFrom: michaeljgruber@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: frederik@ofb.net, notmuch@notmuchmail.org X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Country: DE X-Migadu-Flow: FLOW_IN X-Spam: Yes X-Migadu-Spam: Yes X-Migadu-Spam-Score: 9.32 X-Spam-Score: 9.32 X-Migadu-Queue-Id: 794CF44B41 X-Migadu-Scanner: mx11.migadu.com X-TUID: EKdk/GI4VqJd Am So., 13. Okt. 2024 um 00:59 Uhr schrieb David Bremner : > > David Bremner writes: > > > Frederick Eaton writes: > > > >> If Notmuch is meant to function as an abstraction layer over message > >> files stored on the file system, then why doesn't it provide a > >> standard way to go from file paths to Notmuch messages? > > > > Although I think notmuch as it exists is far from "an abstraction > > layer", the specific feature request seems reasonable. It would need > > someone who wants it to get familiar with the low level implementation > > details of notmuch. In particular it would require writing a database > > upgrade and having a new version of the database schema. > > I was looking at the code, and I realized it is not actually as hard as > that. Essentially the code of notmuch_database_find_message_by_filename > needs to be wrapped in a PostingSource following the model of > RegexpPostingSource (regexp-fields.cc). The fact that no database format > changes (or even reindexing) are needed, makes this a much lower risk > project. If you want to map filenames to mids, you can use xapian. Say, $relone is the filename path relative to the notmuch basedir ~/.mail/.notmuch/. ``` dirterm=XDIRECTORY$(dirname $relone) dirdocid=$(xapian-delve -1 -t $dirterm ~/.mail/.notmuch/xapian/ | tail -n1) docterm=XFDIRENTRY${dirdocid}:$(basename $relone) docid=$(xapian-delve -1 -t $docterm ~/.mail/.notmuch/xapian/ | tail -n1) xapian-delve -1 -t $docterm -r $docid -V1 ~/.mail/.notmuch/xapian/ | grep Value | cut -d' ' -f6- ``` ... or grep Message-ID :) Cheers Michael