Handle a date range. More...
Public Member Functions | |
DateRangeProcessor (Xapian::valueno slot_, unsigned flags_=0, int epoch_year_=1970) | |
Constructor. More... | |
DateRangeProcessor (Xapian::valueno slot_, const std::string &str_, unsigned flags_=0, int epoch_year_=1970) | |
Constructor. More... | |
Xapian::Query | operator() (const std::string &begin, const std::string &end) |
Check for a valid date range. More... | |
Public Member Functions inherited from Xapian::RangeProcessor | |
RangeProcessor () | |
Default constructor. More... | |
RangeProcessor (Xapian::valueno slot_, const std::string &str_=std::string(), unsigned flags_=0) | |
Constructor. More... | |
virtual | ~RangeProcessor () |
Destructor. | |
Xapian::Query | check_range (const std::string &b, const std::string &e) |
RangeProcessor * | release () |
const RangeProcessor * | release () const |
Additional Inherited Members | |
Protected Attributes inherited from Xapian::RangeProcessor | |
Xapian::valueno | slot |
std::string | str |
unsigned | flags |
Handle a date range.
Begin and end must be dates in a recognised format.
|
inlineexplicit |
Constructor.
slot_ | The value number to return from operator(). |
flags_ | Zero or more of the following flags, combined with bitwise-or:
|
epoch_year_ | Year to use as the epoch for dates with 2 digit years (default: 1970, so 1/1/69 is 2069 while 1/1/70 is 1970). |
|
inline |
Constructor.
slot_ | The value slot number to query. |
str_ | A string to look for to recognise values as belonging to this date range. |
flags_ | Zero or more of the following flags, combined with bitwise-or:
|
epoch_year_ | Year to use as the epoch for dates with 2 digit years (default: 1970, so 1/1/69 is 2069 while 1/1/70 is 1970). |
The string supplied in str_ is used by operator() to decide whether the pair of strings supplied to it constitute a valid range. If prefix_ is true, the first value in a range must begin with str_ (and the second value may optionally begin with str_); if prefix_ is false, the second value in a range must end with str_ (and the first value may optionally end with str_).
If str_ is empty, the Xapian::RP_SUFFIX and Xapian::RP_REPEATED are irrelevant, and no special strings are required at the start or end of the strings defining the range.
The remainder of both strings defining the endpoints must be valid dates.
For example, if str_ is "created:", Xapian::RP_SUFFIX is not specified, and the range processor has been added to the queryparser, the queryparser will accept "created:1/1/2000..31/12/2001".
|
virtual |
Check for a valid date range.
If any specified prefix is present, and the range looks like a date range, the dates are converted to the format YYYYMMDD and combined into a value range query.
begin | The start of the range as specified in the query string by the user. |
end | The end of the range as specified in the query string by the user. |
Reimplemented from Xapian::RangeProcessor.