diff options
| author | David Bremner <david@tethera.net> | 2020-07-07 07:56:46 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2020-07-11 17:20:09 -0300 |
| commit | b90d852a2fb377d5b7db4ab2ac389964f8c0c3b3 (patch) | |
| tree | 8a3f425681af11da2ce39d4457acf99a2ea16e46 /lib/parse-time-vrp.h | |
| parent | a1b7cc834bf559184113c837f7511125db18a1aa (diff) | |
lib: migrate from Xapian ValueRangeProcessor to RangeProcessor
This will be mandatory as of Xapian 1.5. The API is also more
consistent with the FieldProcessor API, which helps code re-use a bit.
Note that this switches to using the built-in Xapian support for
prefixes on ranges (i.e. deleted code at beginning of
ParseTimeRangeProcessor::operator(), added prefix to constructor).
Another side effect of the migration is that we are generating smaller
queries, using one OP_VALUE_RANGE instead of an AND of two OP_VALUE_*
queries.
Diffstat (limited to 'lib/parse-time-vrp.h')
| -rw-r--r-- | lib/parse-time-vrp.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/parse-time-vrp.h b/lib/parse-time-vrp.h index 9fb1af60..f495e716 100644 --- a/lib/parse-time-vrp.h +++ b/lib/parse-time-vrp.h @@ -26,21 +26,21 @@ #include <xapian.h> /* see *ValueRangeProcessor in xapian-core/include/xapian/queryparser.h */ -class ParseTimeValueRangeProcessor : public Xapian::ValueRangeProcessor { -protected: - Xapian::valueno valno; +class ParseTimeRangeProcessor : public Xapian::RangeProcessor { public: - ParseTimeValueRangeProcessor (Xapian::valueno slot_) - : valno (slot_) - { - } + ParseTimeRangeProcessor (Xapian::valueno slot_, const std::string prefix_) + : Xapian::RangeProcessor(slot_, prefix_, 0) { } - Xapian::valueno operator() (std::string &begin, std::string &end); + Xapian::Query operator() (const std::string &begin, const std::string &end); }; class DateFieldProcessor : public Xapian::FieldProcessor { - Xapian::Query operator() (const std::string & str); +private: + Xapian::valueno slot; +public: + DateFieldProcessor(Xapian::valueno slot_) : slot(slot_) { }; + Xapian::Query operator()(const std::string & str); }; #endif /* NOTMUCH_PARSE_TIME_VRP_H */ |
