aboutsummaryrefslogtreecommitdiffstats
path: root/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@vespa.ai>2024-01-12 12:07:45 +0000
committerTor Brede Vekterli <vekterli@vespa.ai>2024-01-15 16:23:53 +0000
commitae88431f3770388afd22c6856b2ad17c994783ee (patch)
tree934f74c09ac9293269d6e38cac3e9b9359da49b5 /streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp
parent242fee291a7aefab01f8d22e2059d57201d66c10 (diff)
Add regular expression support to streaming search
Introduces an explicit regex query term node (which wraps an RE2 regex instance internally) and extends the existing UTF-8 flexible string searcher to use this query node. Regex matching is optionally case (in)sensitive depending on the normalization mode used. Note on `searcher/searcher_test.cpp`: this adds a magic sentinel `#` char prefix to query term parsing in the test to let a query term be interpreted as a regex rather than exact/prefix/suffix/substring match.
Diffstat (limited to 'streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp')
-rw-r--r--streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp b/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp
index 715c19a0bb7..468d8e0145a 100644
--- a/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp
+++ b/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp
@@ -134,7 +134,8 @@ FieldSearchSpec::reconfig(const QueryTerm & term)
if ((term.isSubstring() && _arg1 != "substring") ||
(term.isSuffix() && _arg1 != "suffix") ||
(term.isExactstring() && _arg1 != "exact") ||
- (term.isPrefix() && _arg1 == "suffix"))
+ (term.isPrefix() && _arg1 == "suffix") ||
+ term.isRegex())
{
_searcher = std::make_unique<UTF8FlexibleStringFieldSearcher>(id());
// preserve the basic match property of the searcher