aboutsummaryrefslogtreecommitdiff
path: root/lib/regexp-fields.cc
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2022-02-24 22:41:03 -0400
committerDavid Bremner <david@tethera.net>2022-03-19 07:27:29 -0300
commit8ed6a172b35708428f84f30af44fa81c12852e43 (patch)
tree64c1a4a8b2beb13abacb74aa77ecaefb555ec976 /lib/regexp-fields.cc
parentc9ed87f39f54b83ecafc719e848909da6074075f (diff)
lib: do not phrase parse prefixed bracketed subexpressions
Since Xapian does not preserve quotes when passing the subquery to a field processor, we have to make a guess as to what the user intended. Here the added assumption is that a string surrounded by parens is not intended to be a phrase.
Diffstat (limited to 'lib/regexp-fields.cc')
-rw-r--r--lib/regexp-fields.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/regexp-fields.cc b/lib/regexp-fields.cc
index 7e9d959c..539915d8 100644
--- a/lib/regexp-fields.cc
+++ b/lib/regexp-fields.cc
@@ -227,7 +227,8 @@ RegexpFieldProcessor::operator() (const std::string & str)
* phrase parsing, when possible */
std::string query_str;
- if (*str.rbegin () != '*' || str.find (' ') != std::string::npos)
+ if ((str.at (0) != '(' || *str.rbegin () != ')') &&
+ (*str.rbegin () != '*' || str.find (' ') != std::string::npos))
query_str = '"' + str + '"';
else
query_str = str;