From: Steinar H. Gunderson Date: Wed, 30 Sep 2020 18:03:54 +0000 (+0200) Subject: Fix a bug where posting lists intersecting to nothing would not early-abort properly. X-Git-Tag: 1.0.0~83 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=c36cd135f2e514a6dafe04ca500f814a1f0593b0;p=plocate Fix a bug where posting lists intersecting to nothing would not early-abort properly. --- diff --git a/plocate.cpp b/plocate.cpp index 84fcd7a..ea7a4e8 100644 --- a/plocate.cpp +++ b/plocate.cpp @@ -339,6 +339,7 @@ void do_search_file(const string &needle, const char *filename) break; } engine.submit_read(fd, len, trgmptr.offset, [trgmptr, len, &done, &in1, &in2, &out](string s) { + if (done) return; uint32_t trgm __attribute__((unused)) = trgmptr.trgm; size_t num = trgmptr.num_docids; unsigned char *pldata = reinterpret_cast(s.data()); @@ -369,6 +370,9 @@ void do_search_file(const string &needle, const char *filename) }); } engine.finish(); + if (done) { + return; + } dprintf("Intersection done after %.1f ms. Doing final verification and printing:\n", 1e3 * duration(steady_clock::now() - start).count());