#include "regexp-fields.h"
#include "notmuch-private.h"
#include "database-private.h"
+#include "xapian-extra.h"
notmuch_status_t
compile_regex (regex_t ®exp, const char *str, std::string &msg)
if (str.empty ()) {
if (options & NOTMUCH_FIELD_PROBABILISTIC) {
return Xapian::Query (Xapian::Query::OP_AND_NOT,
- Xapian::Query::MatchAll,
+ xapian_query_match_all (),
Xapian::Query (Xapian::Query::OP_WILDCARD, term_prefix));
} else {
return Xapian::Query (term_prefix);
* 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;
return parser.parse_query (query_str, NOTMUCH_QUERY_PARSER_FLAGS, term_prefix);
} else {
/* Boolean prefix */
- std::string term = term_prefix + str;
+ std::string query_str;
+ std::string term;
+
+ if (str.length () > 1 && str.at (str.size () - 1) == '/')
+ query_str = str.substr (0, str.size () - 1);
+ else
+ query_str = str;
+
+ term = term_prefix + query_str;
return Xapian::Query (term);
}
}