]> git.sesse.net Git - plocate/commitdiff
Fix a bug where posting lists intersecting to nothing would not early-abort properly.
authorSteinar H. Gunderson <steinar+git@gunderson.no>
Wed, 30 Sep 2020 18:03:54 +0000 (20:03 +0200)
committerSteinar H. Gunderson <steinar+git@gunderson.no>
Wed, 30 Sep 2020 18:03:54 +0000 (20:03 +0200)
plocate.cpp

index 84fcd7a7e47a93e0b85a453e742e50bd444df994..ea7a4e818e7eb5361a80894a5dedf5a12016c71e 100644 (file)
@@ -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<unsigned char *>(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<float>(steady_clock::now() - start).count());