query: move phrasification to mu-query-parser

Do the "phrasification" for matching fields later during query parsing;
this allows for handling combination fields correctly.

Also match both the normal term and the "phrase term", so we catch more
cases. Update/extend unit tests.

This fixes the "kata-container" issue also for body test.

Fixes #2167.
This commit is contained in:
Dirk-Jan C. Binnema
2023-09-17 18:11:21 +03:00
parent 7cbab21099
commit 5bda8c321b
4 changed files with 76 additions and 41 deletions

View File

@ -131,6 +131,7 @@ I said: "Aujourd'hui!"
}};
TempDir tdir;
auto store{make_test_store(tdir.path(), test_msgs, {})};
store.commit();
// matches
for (auto&& expr: {
@ -692,6 +693,8 @@ Date: Wed, 26 Oct 2022 11:01:54 -0700
To: example@example.com
Subject: kata-containers
voodoo-containers
Boo!
)"},
}};
@ -699,10 +702,13 @@ Boo!
TempDir tdir;
auto store{make_test_store(tdir.path(), test_msgs, {})};
/* true: match; false: no match */
const auto cases = std::array<std::pair<const char*, bool>, 3>{{
const auto cases = std::vector<std::pair<const char*, bool>>{{
{"subject:kata", true},
{"subject:containers", true},
{"subject:kata-containers", true}
{"subject:kata-containers", true},
{"subject:\"kata containers\"", true},
{"voodoo-containers", true},
{"voodoo containers", true}
}};
for (auto&& test: cases) {