]> git.notmuchmail.org Git - notmuch/blobdiff - lib/regexp-fields.cc
Merge branch 'release'
[notmuch] / lib / regexp-fields.cc
index 8e740a810064a8e80bae40ad75045b975c7c2286..9dcf973263743ea01721bf139569cafa17577943 100644 (file)
@@ -158,8 +158,14 @@ RegexpFieldProcessor::operator() (const std::string & str)
     } else {
        /* TODO replace this with a nicer API level triggering of
         * phrase parsing, when possible */
-       std::string quoted='"' + str + '"';
-       return parser.parse_query (quoted, NOTMUCH_QUERY_PARSER_FLAGS, term_prefix);
+       std::string query_str;
+
+       if (str.find (' ') != std::string::npos)
+           query_str = '"' + str + '"';
+       else
+           query_str = str;
+
+       return parser.parse_query (query_str, NOTMUCH_QUERY_PARSER_FLAGS, term_prefix);
     }
 }
 #endif