Terminate query execution early if subterm returns empty result set
Summary:
Leaf queries may return an empty result set, which is signalled by
returning a nullptr. Immediately break if the query is part of an
Term::And, and omit it if it is a Term::Or.
As creating the PostingOperator implicitly executes the database
query, it is beneficial to omit queries whose result is not used
anyway.
Reviewers: Baloo, michaelh, Frameworks, dhaumann
Reviewed By: dhaumann
Subscribers: kde-frameworks-devel, Frameworks
Tags: Frameworks, Baloo
Differential Revision: https://phabricator.kde.org/D12025