#include <queryparser.h>


Public Member Functions | |
| DateValueRangeProcessor (Xapian::valueno slot_, bool prefer_mdy_=false, int epoch_year_=1970) | |
| Constructor. | |
| DateValueRangeProcessor (Xapian::valueno slot_, const std::string &str_, bool prefix_=true, bool prefer_mdy_=false, int epoch_year_=1970) | |
| Constructor. | |
| DateValueRangeProcessor (Xapian::valueno slot_, const char *str_, bool prefix_=true, bool prefer_mdy_=false, int epoch_year_=1970) | |
| Constructor. | |
| Xapian::valueno | operator() (std::string &begin, std::string &end) |
| Check for a valid date range. | |
Private Attributes | |
| bool | prefer_mdy |
| int | epoch_year |
Begin and end must be dates in a recognised format.
Definition at line 161 of file queryparser.h.
| Xapian::DateValueRangeProcessor::DateValueRangeProcessor | ( | Xapian::valueno | slot_, | |
| bool | prefer_mdy_ = false, |
|||
| int | epoch_year_ = 1970 | |||
| ) | [inline] |
Constructor.
| slot_ | The value number to return from operator(). | |
| prefer_mdy_ | Should ambiguous dates be interpreted as month/day/year rather than day/month/year? (default: false) | |
| 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). |
Definition at line 176 of file queryparser.h.
| Xapian::DateValueRangeProcessor::DateValueRangeProcessor | ( | Xapian::valueno | slot_, | |
| const std::string & | str_, | |||
| bool | prefix_ = true, |
|||
| bool | prefer_mdy_ = false, |
|||
| int | epoch_year_ = 1970 | |||
| ) | [inline] |
Constructor.
| slot_ | The value number to return from operator(). | |
| str_ | A string to look for to recognise values as belonging to this date range. | |
| prefix_ | Whether to look for the string at the start or end of the values. If true, the string is a prefix; if false, the string is a suffix (default: true). | |
| prefer_mdy_ | Should ambiguous dates be interpreted as month/day/year rather than day/month/year? (default: false) | |
| 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). |
If str_ is empty, the setting of prefix_ is 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:" and prefix_ is true, and the range processor has been added to the queryparser, the queryparser will accept "created:1/1/2000..31/12/2001".
Definition at line 218 of file queryparser.h.
| Xapian::DateValueRangeProcessor::DateValueRangeProcessor | ( | Xapian::valueno | slot_, | |
| const char * | str_, | |||
| bool | prefix_ = true, |
|||
| bool | prefer_mdy_ = false, |
|||
| int | epoch_year_ = 1970 | |||
| ) | [inline] |
Constructor.
This is like the previous version, but with const char * instead of std::string - we need this overload as otherwise DateValueRangeProcessor(1, "date:") quietly interprets the second argument as a boolean in preference to std::string. If you want to be compatible with 1.2.12 and earlier, then explicitly convert to std::string, i.e.: DateValueRangeProcessor(1, std::string("date:"))
| slot_ | The value number to return from operator(). | |
| str_ | A string to look for to recognise values as belonging to this date range. | |
| prefix_ | Whether to look for the string at the start or end of the values. If true, the string is a prefix; if false, the string is a suffix (default: true). | |
| prefer_mdy_ | Should ambiguous dates be interpreted as month/day/year rather than day/month/year? (default: false) | |
| 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). |
If str_ is empty, the setting of prefix_ is 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:" and prefix_ is true, and the range processor has been added to the queryparser, the queryparser will accept "created:1/1/2000..31/12/2001".
Definition at line 269 of file queryparser.h.
| Xapian::valueno Xapian::DateValueRangeProcessor::operator() | ( | std::string & | begin, | |
| std::string & | end | |||
| ) | [virtual] |
Check for a valid date range.
| [in,out] | begin | The start of the range as specified in the query string by the user. This parameter is a non-const reference so the ValueRangeProcessor can modify it to return the value to start the range with. |
| [in,out] | end | The end of the range. This is also a non-const reference so it can be modified. |
Reimplemented from Xapian::StringValueRangeProcessor.
Definition at line 122 of file valuerangeproc.cc.
References Xapian::BAD_VALUENO, Xapian::decode_xxy(), epoch_year, Xapian::is_yyyy_mm_dd(), prefer_mdy, SNPRINTF, Xapian::StringValueRangeProcessor::valno, and Xapian::vet_dm().
int Xapian::DateValueRangeProcessor::epoch_year [private] |
bool Xapian::DateValueRangeProcessor::prefer_mdy [private] |