Geary.ImapDb.SearchQuery: Handle queries with some/all negated terms

SQLite FTS5 doesn't allow all negated terms in matches, and since NOT
is a binary operator (rather than unary) negated terms should be listed
after any positive terms.
This commit is contained in:
Michael Gratton 2020-11-05 00:07:08 +11:00 committed by Michael James Gratton
parent 6ffbfcf5d4
commit 2ab7b2c39e
2 changed files with 147 additions and 42 deletions

View file

@ -163,6 +163,11 @@ public class Geary.ImapDB.SearchQueryTest : TestCase {
);
assert_queries(unread);
var read_term = new Geary.SearchQuery.EmailFlagTerm(Geary.EmailFlags.UNREAD);
read_term.is_negated = true;
var read = new_search_query({ read_term }, "is:read");
assert_queries(read);
var flagged = new_search_query(
{ new Geary.SearchQuery.EmailFlagTerm(Geary.EmailFlags.FLAGGED)},
"is:flagged"