unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* can a notmuch query filter the output based on the size of a thread?
@ 2019-11-11 15:32 Daniel Kahn Gillmor
  2019-11-11 17:48 ` Jameson Graef Rollins
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Kahn Gillmor @ 2019-11-11 15:32 UTC (permalink / raw)
  To: Notmuch Mail

[-- Attachment #1: Type: text/plain, Size: 440 bytes --]

Over on https://github.com/pazz/alot/issues/1449, a user asks:

>  I would like to query for `mailcount`, for example
>  to search for mails on a mailing list which got answered 
>  `:search tag:list/questions and mailcount>1`
>  or
>  `:search tag:list/questions and not mailcount:1`

This seems like a question for notmuch (and maybe for xapian).  I don't
know how to do it off the top of my head.  Any takers?

        --dkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

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

* Re: can a notmuch query filter the output based on the size of a thread?
  2019-11-11 15:32 can a notmuch query filter the output based on the size of a thread? Daniel Kahn Gillmor
@ 2019-11-11 17:48 ` Jameson Graef Rollins
  2019-11-11 18:40   ` Daniel Kahn Gillmor
  0 siblings, 1 reply; 8+ messages in thread
From: Jameson Graef Rollins @ 2019-11-11 17:48 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, Notmuch Mail

On Mon, Nov 11 2019, Daniel Kahn Gillmor <dkg@fifthhorseman.net> wrote:
> Over on https://github.com/pazz/alot/issues/1449, a user asks:
>
>>  I would like to query for `mailcount`, for example
>>  to search for mails on a mailing list which got answered 
>>  `:search tag:list/questions and mailcount>1`
>>  or
>>  `:search tag:list/questions and not mailcount:1`
>
> This seems like a question for notmuch (and maybe for xapian).  I don't
> know how to do it off the top of my head.  Any takers?

I'm not sure I understand what the question is.  They want to count
messages, i.e. "notmuch count"?

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

* Re: can a notmuch query filter the output based on the size of a thread?
  2019-11-11 17:48 ` Jameson Graef Rollins
@ 2019-11-11 18:40   ` Daniel Kahn Gillmor
  2019-11-11 19:08     ` Jameson Graef Rollins
  2019-11-16 15:38     ` David Bremner
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel Kahn Gillmor @ 2019-11-11 18:40 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

[-- Attachment #1: Type: text/plain, Size: 787 bytes --]

On Mon 2019-11-11 09:48:47 -0800, Jameson Graef Rollins wrote:
> On Mon, Nov 11 2019, Daniel Kahn Gillmor <dkg@fifthhorseman.net> wrote:
>> Over on https://github.com/pazz/alot/issues/1449, a user asks:
>>
>>>  I would like to query for `mailcount`, for example
>>>  to search for mails on a mailing list which got answered 
>>>  `:search tag:list/questions and mailcount>1`
>>>  or
>>>  `:search tag:list/questions and not mailcount:1`
>
> I'm not sure I understand what the question is.  They want to count
> messages, i.e. "notmuch count"?

nope, i think they want:

   - show me all threads where:
      - at least one message has the tag 'list/questions', and
      - at least two distinct messages are present

does that make more sense?

      --dkg
      

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

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

* Re: can a notmuch query filter the output based on the size of a thread?
  2019-11-11 18:40   ` Daniel Kahn Gillmor
@ 2019-11-11 19:08     ` Jameson Graef Rollins
  2019-11-16 15:31       ` David Bremner
  2019-11-16 15:38     ` David Bremner
  1 sibling, 1 reply; 8+ messages in thread
From: Jameson Graef Rollins @ 2019-11-11 19:08 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, Notmuch Mail

On Mon, Nov 11 2019, Daniel Kahn Gillmor <dkg@fifthhorseman.net> wrote:
> On Mon 2019-11-11 09:48:47 -0800, Jameson Graef Rollins wrote:
>> I'm not sure I understand what the question is.  They want to count
>> messages, i.e. "notmuch count"?
>
> nope, i think they want:
>
>    - show me all threads where:
>       - at least one message has the tag 'list/questions', and

I have never personally had the need to search based on numbers of
messages, but I have definitely thought that it would be good if
searches worked over entire threads instead of just messages.  I would
much prefer if a search for "foo AND bar" would turn up a thread where
"foo" was mentioned in one message in the thread and "bar" was mentioned
in another.  I think that would be very useful.

>       - at least two distinct messages are present
>
> does that make more sense?
>
>       --dkg
>       

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

* Re: can a notmuch query filter the output based on the size of a thread?
  2019-11-11 19:08     ` Jameson Graef Rollins
@ 2019-11-16 15:31       ` David Bremner
  0 siblings, 0 replies; 8+ messages in thread
From: David Bremner @ 2019-11-16 15:31 UTC (permalink / raw)
  To: Jameson Graef Rollins, Daniel Kahn Gillmor, Notmuch Mail

Jameson Graef Rollins <jrollins@caltech.edu> writes:

> I have never personally had the need to search based on numbers of
> messages, but I have definitely thought that it would be good if
> searches worked over entire threads instead of just messages.  I would
> much prefer if a search for "foo AND bar" would turn up a thread where
> "foo" was mentioned in one message in the thread and "bar" was mentioned
> in another.  I think that would be very useful.

You can use thread:{foo AND bar} for that (with appropriate quoting).

There is a noticable performance penalty.

d

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

* Re: can a notmuch query filter the output based on the size of a thread?
  2019-11-11 18:40   ` Daniel Kahn Gillmor
  2019-11-11 19:08     ` Jameson Graef Rollins
@ 2019-11-16 15:38     ` David Bremner
  2019-11-16 20:18       ` Daniel Kahn Gillmor
  1 sibling, 1 reply; 8+ messages in thread
From: David Bremner @ 2019-11-16 15:38 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, Jameson Graef Rollins, Notmuch Mail

Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:

> nope, i think they want:
>
>    - show me all threads where:
>       - at least one message has the tag 'list/questions', and
>       - at least two distinct messages are present
>
> does that make more sense?
>

I don't see an easy way to do this without adding machinery like for the
"thread:{}" queries. This comes with a definite performance hit as it
reads the whole thread during the query construction. Currently notmuch
does not store a mapping from threads to messages in the database, but
only from messages to threads.

Alternatively someone (TM) could add thread objects to the notmuch
database. This would allow much faster thread operations, but would
require some fairly delicate maintenance of the thread
objects. Basically they would need to updated every time a message is
added or removed from the database, and potentially garbage collected.

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

* Re: can a notmuch query filter the output based on the size of a thread?
  2019-11-16 15:38     ` David Bremner
@ 2019-11-16 20:18       ` Daniel Kahn Gillmor
  2019-11-17 12:36         ` David Bremner
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Kahn Gillmor @ 2019-11-16 20:18 UTC (permalink / raw)
  To: David Bremner, Jameson Graef Rollins, Notmuch Mail

[-- Attachment #1: Type: text/plain, Size: 750 bytes --]

On Sat 2019-11-16 10:38:44 -0500, David Bremner wrote:
> Alternatively someone (TM) could add thread objects to the notmuch
> database. This would allow much faster thread operations, but would
> require some fairly delicate maintenance of the thread
> objects. Basically they would need to updated every time a message is
> added or removed from the database, and potentially garbage collected.

This is a pretty interesting idea (though not something i'm likely to
get around to in the near future personally).

Just to flesh it out a bit further, do you think that such a thread
object would have anything attached to it other than message-count? or
maybe a list of message-ids?  dates?  aggregated senders?  aggregated
recipients?

        --dkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

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

* Re: can a notmuch query filter the output based on the size of a thread?
  2019-11-16 20:18       ` Daniel Kahn Gillmor
@ 2019-11-17 12:36         ` David Bremner
  0 siblings, 0 replies; 8+ messages in thread
From: David Bremner @ 2019-11-17 12:36 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, Jameson Graef Rollins, Notmuch Mail

Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:

> Just to flesh it out a bit further, do you think that such a thread
> object would have anything attached to it other than message-count? or
> maybe a list of message-ids?  dates?  aggregated senders?  aggregated
> recipients?

I think it would have the union of terms (tags, words, prefixed terms
from e.g. subject) in messages in the thread to allow
"thread:{foo AND bar}" to be done fast. At one point Olly convinced me
that it would be feasible to delete the terms in a sensible way (i.e. to
simulate reference counting) when a message is deleted, but I'm hazy on
the details at this point. dates might be especially tricky.

d

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

end of thread, other threads:[~2019-11-17 13:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-11 15:32 can a notmuch query filter the output based on the size of a thread? Daniel Kahn Gillmor
2019-11-11 17:48 ` Jameson Graef Rollins
2019-11-11 18:40   ` Daniel Kahn Gillmor
2019-11-11 19:08     ` Jameson Graef Rollins
2019-11-16 15:31       ` David Bremner
2019-11-16 15:38     ` David Bremner
2019-11-16 20:18       ` Daniel Kahn Gillmor
2019-11-17 12:36         ` 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).