On Wed, Mar 08, 2017 at 10:32:56PM -0400, David Bremner wrote: > "Kirill A. Shutemov" <kirill@shutemov.name> writes: > > I found that on particular queries notmuch return different results if run > > the query few times. Re-initialing the query or db doesn't help. > > Thanks for the report. I don't yet understand where the bug is, but I > think it's safe to say it's not in your code. I made a somewhat simpler > test case that displays the same problem (at the end). It's a bug in Xapian - I've committed a fix to master (commit fa12a83957e97349aa6e2a6c0896faf210dfe4b4) which I'll backport for 1.4.4 and 1.2.25 (it also affects 1.2.x). To trigger it you need an AND operator which is unweighted (e.g. being on the right side of AND_NOT here) with a subquery which uses the passed max weight value (the obvious case is another operator, OR in this case). (David already confirmed on IRC that the fix applied solves this for him.) Cheers, Olly