diff options
author | Tor Brede Vekterli <vekterli@vespa.ai> | 2024-01-22 14:54:27 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@vespa.ai> | 2024-01-22 14:54:27 +0000 |
commit | 00c89ec2a67dbd32e88204cc6a0cafa099cf0f0c (patch) | |
tree | 36db685df5fea09ad857aaae3bc8037887cf72fc /streamingvisitors/src/tests/searcher/searcher_test.cpp | |
parent | ccda952db487445f3522eecbcbfee4a6f6a90c32 (diff) |
Treat regex and fuzzy whole-field matching as 1 logical word
We have concluded that this is the most semantically correct way
of reporting the count, and as a bonus it avoids having to do a
separate pass over the string buffer.
Diffstat (limited to 'streamingvisitors/src/tests/searcher/searcher_test.cpp')
-rw-r--r-- | streamingvisitors/src/tests/searcher/searcher_test.cpp | 16 |
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)); |