Re: [PATCH 4/4] CLI/git: replace calls to notmuch-search with database access

2022-07-09 Thread Michael J Gruber
Am Do., 7. Juli 2022 um 17:59 Uhr schrieb David Bremner :
>
> Tomi Ollila  writes:
>
> > On Sun, Jul 03 2022, David Bremner wrote:
> >
> > I've trying to think if there were a way to somehow run only one notmuch
> > command instead of notmuch search on all maeby-deleted files -- or
> > alternatively attempt to load python bindings and in case of failure use
> > the notmuch-search methid...
> >
>
> We could run one notmuch-dump command to get a list of the message-ids
> in the database, and build a dictionary in memory. Might be a bit slow?
> Here it would take 10-15s just do the dump. But certainly faster than
> 500K execs of notmuch search

When I first saw that `notmuch-git` is implemented in python and calls
out to `notmuch search` I wondered: Why doesn't it use the python
bindings?

I don't think "building the project partially and installing by
copying parts somewhere" is a use case that the design implementation
has to cater for, especially if this incurs performance penalties.
Scripting around `notmuch dump` does not make things better.

I do understand that you want lean dependencies server side, but
having python there isn't really uncommon, is it?

If building and installing from git via `make install` is too much of
a hassle we should probably work on reducing the hassle ;)

Cheers
Michael
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


quoting: (was: Re: bug#56442: gnus-search-run-search: Hits notmuch command line length limits)

2022-07-09 Thread Tomi Ollila
On Sat, Jul 09 2022, Eric Abrahamsen wrote:

>
> Huh, I tried this a couple months ago with a more complicated query,
> like:
>
> thread:{from:bob or from:jane}
>
> and I remember notmuch barking at me about spaces or the "or" or
> something -- anyway I got the impression that it couldn't accept
> multi-part queries inside the "thread:{}" syntax. But looking at your
> patch maybe I just needed to quote differently?

I am not sure whether this is relevant, but I give a shot...

I tried the following queries from command line:

$ notmuch search 'thread:"{from:bob or from:jane}"'

thread:0b91   2009-01-20 [6/6] ...
thread:15fa   2008-11-26 [2/2] ...

and

$ notmuch search 'from:bob or from:jane}':

thread:0b91   2009-01-20 [1/6] ...
thread:15fa   2008-11-26 [1/2] ...


The outer '':s protect from shell expansion so what is
inside those goes verbatim to notmuch and from there to
xapian query parser (IIRC). 

Former includes all messages in thread where at least
one message matched to the query and latter just those
messages that match the query.

Like Sean mentioned in another message, Xapian converts ""
to " in query string (probably something irrelevant in this
discussion) the thread:"{...}" syntax binds the whole expression
to this thread: prefix (Why {...} is not enough is beyond me ;D)

Tomi

>
> Anyway I'll give this a test this weekend. It would be *very* nice if we
> could use this syntax rather than the ugly home-grown one.
>
> Thanks for the report!
>
> Eric
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: bug#56442: gnus-search-run-search: Hits notmuch command line length limits

2022-07-09 Thread Sean Whitton
Hello,

On Sat 09 Jul 2022 at 09:11AM -07, Eric Abrahamsen wrote:

> But looking at your patch maybe I just needed to quote differently?

Right, notmuch has this unusual " -> "" quoting thing.

> Anyway I'll give this a test this weekend. It would be *very* nice if
> we could use this syntax rather than the ugly home-grown one.

Let me know the results of your test, and if it's also continuing to
work for me by then, I'll install the change.  Thanks for taking a look.

-- 
Sean Whitton
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: bug#56442: gnus-search-run-search: Hits notmuch command line length limits

2022-07-09 Thread Eric Abrahamsen
Sean Whitton  writes:

> Hello,
>
> I'm running a pretty innocent notmuch query over a fairly small Maildir:
>
> "((List:debian-devel.lists.debian.org) or ... or
> (List:debian-haskell.lists.debian.org) or
> (List:debconf-discuss.lists.debian.org)) and (not path:annex/**)"
>
> but gnus-search-run-search fails to return any results.  The reason is
> that Gnus first runs the query with --output=threads to obtain a list of
> thread ids, and then runs another query with --output=files and a query
> constructed from the output of the first query: "thread:d9d0
> or thread:d9e0 or thread:d268 or ..."
>
> The resulting command fails completely:
>
> emacs: /usr/bin/notmuch: Argument list too long
>
> Instead of running two searches like this, we can just surround the
> whole query like this: "thread:{QUERY}".  The manual says it's exactly
> equivalent:
>
> ... the user should think of the query thread:{} as
> expanding to all of the thread IDs which match ; not‐
> much then performs a second search using the expanded query.
>
> This should be faster, too, with only running a single external command.
> Here is the patch I'm thinking I'll apply, if anyone has comments.

Huh, I tried this a couple months ago with a more complicated query,
like:

thread:{from:bob or from:jane}

and I remember notmuch barking at me about spaces or the "or" or
something -- anyway I got the impression that it couldn't accept
multi-part queries inside the "thread:{}" syntax. But looking at your
patch maybe I just needed to quote differently?

Anyway I'll give this a test this weekend. It would be *very* nice if we
could use this syntax rather than the ugly home-grown one.

Thanks for the report!

Eric
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org