]> git.sesse.net Git - plocate/commitdiff
Full scans (not trigram-based) would always print counts, even without -c. Fix.
authorSteinar H. Gunderson <steinar+git@gunderson.no>
Fri, 9 Oct 2020 21:48:56 +0000 (23:48 +0200)
committerSteinar H. Gunderson <steinar+git@gunderson.no>
Fri, 9 Oct 2020 21:48:56 +0000 (23:48 +0200)
plocate.cpp

index e219db0d5507a2cfd97e87b97b155cca9b5b41f6..f07b687630967a1d7f3e828c6c9fbb340006380a 100644 (file)
@@ -369,7 +369,9 @@ void do_search_file(const vector<string> &needles, const char *filename)
                // the pattern and done a union of them, but that's a lot of
                // work for fairly unclear gain.)
                uint64_t matched = scan_all_docids(needles, fd, corpus, &engine);
-               printf("%zu\n", matched);
+               if (only_count) {
+                       printf("%zu\n", matched);
+               }
                return;
        }
        sort(trigrams.begin(), trigrams.end());