summaryrefslogtreecommitdiffstats
path: root/streamingvisitors/src/tests/searcher
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-01-22 17:00:54 +0100
committerGitHub <noreply@github.com>2024-01-22 17:00:54 +0100
commitfb0271e2a858053eec087902e1951c5fd8845bb0 (patch)
tree4738dddfbf0f4717d1ad8c636cc2107628f99189 /streamingvisitors/src/tests/searcher
parentf6df06778a294bde9a4a1579a16a49359d560ad9 (diff)
parent00c89ec2a67dbd32e88204cc6a0cafa099cf0f0c (diff)
Merge pull request #30016 from vespa-engine/vekterli/count-regex-and-fuzzy-field-as-1-wordv8.291.13
Treat regex and fuzzy whole-field matching as 1 logical word
Diffstat (limited to 'streamingvisitors/src/tests/searcher')
-rw-r--r--streamingvisitors/src/tests/searcher/searcher_test.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/streamingvisitors/src/tests/searcher/searcher_test.cpp b/streamingvisitors/src/tests/searcher/searcher_test.cpp
index 705e14c11a5..eb233db9632 100644
--- a/streamingvisitors/src/tests/searcher/searcher_test.cpp
+++ b/streamingvisitors/src/tests/searcher/searcher_test.cpp
@@ -729,6 +729,14 @@ TEST("utf8 flexible searcher handles regexes with explicit anchoring") {
TEST_DO(assertString(fs, "#^foo$", "oo", Hits()));
}
+TEST("utf8 flexible searcher regex matching treats field as 1 word") {
+ UTF8FlexibleStringFieldSearcher fs(0);
+ // Match case
+ TEST_DO(assertFieldInfo(fs, "#.*", "foo bar baz", QTFieldInfo(0, 1, 1)));
+ // Mismatch case
+ TEST_DO(assertFieldInfo(fs, "#^zoid$", "foo bar baz", QTFieldInfo(0, 0, 1)));
+}
+
TEST("utf8 flexible searcher handles fuzzy search in uncased mode") {
UTF8FlexibleStringFieldSearcher fs(0);
// Term syntax (only applies to these tests):
@@ -819,6 +827,14 @@ TEST("utf8 flexible searcher caps oversized fuzzy prefix length to term length")
TEST_DO(assertString(fs, "%{5,9001}zoid", "boid", Hits()));
}
+TEST("utf8 flexible searcher fuzzy matching treats field as 1 word") {
+ UTF8FlexibleStringFieldSearcher fs(0);
+ // Match case
+ TEST_DO(assertFieldInfo(fs, "%{1}foo bar baz", "foo jar baz", QTFieldInfo(0, 1, 1)));
+ // Mismatch case
+ TEST_DO(assertFieldInfo(fs, "%{1}foo", "foo bar baz", QTFieldInfo(0, 0, 1)));
+}
+
TEST("bool search") {
BoolFieldSearcher fs(0);
TEST_DO(assertBool(fs, "true", true, true));