#ifndef NOTMUCH_REGEXP_FIELDS_H
#define NOTMUCH_REGEXP_FIELDS_H
-#if HAVE_XAPIAN_FIELD_PROCESSOR
+
#include <sys/types.h>
#include <regex.h>
#include "database-private.h"
#include "notmuch-private.h"
+notmuch_status_t
+_notmuch_regex_to_query (notmuch_database_t *notmuch, Xapian::valueno slot, std::string field,
+ std::string regexp_str,
+ Xapian::Query &output, std::string &msg);
+
/* A posting source that returns documents where a value matches a
* regexp.
*/
class RegexpPostingSource : public Xapian::PostingSource
{
- protected:
+protected:
const Xapian::valueno slot_;
regex_t regexp_;
Xapian::Database db_;
RegexpPostingSource (const RegexpPostingSource &);
RegexpPostingSource &operator= (const RegexpPostingSource &);
- public:
+public:
RegexpPostingSource (Xapian::valueno slot, const std::string ®exp);
~RegexpPostingSource ();
void init (const Xapian::Database &db);
class RegexpFieldProcessor : public Xapian::FieldProcessor {
- protected:
+protected:
Xapian::valueno slot;
+ std::string field;
std::string term_prefix;
notmuch_field_flag_t options;
Xapian::QueryParser &parser;
notmuch_database_t *notmuch;
- public:
+public:
RegexpFieldProcessor (std::string prefix, notmuch_field_flag_t options,
Xapian::QueryParser &parser_, notmuch_database_t *notmuch_);
- ~RegexpFieldProcessor () { };
+ ~RegexpFieldProcessor ()
+ {
+ };
- Xapian::Query operator()(const std::string & str);
+ Xapian::Query operator() (const std::string & str);
};
-#endif
+
#endif /* NOTMUCH_REGEXP_FIELDS_H */