Provides support for converting dates to strings and vice-versa. The strings are structured so that lexicographic sorting orders by date, which makes them suitable for use as field values and search terms.
More...
#include <DateField.h>
Provides support for converting dates to strings and vice-versa. The strings are structured so that lexicographic sorting orders by date, which makes them suitable for use as field values and search terms.
Note that this class saves dates with millisecond granularity, which is bad for TermRangeQuery and PrefixQuery, as those queries are expanded to a BooleanQuery with a potentially large number of terms when searching. Thus you might want to use DateTools instead.
Note: dates before 1970 cannot be used, and therefore cannot be indexed when using this class. See {} for an alternative without such a limitation. Another approach is NumericUtils}, which provides a sortable binary representation (prefix encoded) of numeric values, which date/time are. For indexing a Date} or Calendar}, just get the unix timestamp as long using Date#getTime} or Calendar#getTimeInMillis} and index this as a numeric value with NumericField} and use NumericRangeQuery} to query it. deprecated 1.
◆ ~DateField()
virtual Lucene::DateField::~DateField |
( |
| ) |
|
|
virtual |
◆ _getClassName()
static String Lucene::DateField::_getClassName |
( |
| ) |
|
|
inlinestatic |
◆ DATE_LEN()
static int32_t Lucene::DateField::DATE_LEN |
( |
| ) |
|
|
staticprotected |
◆ dateToString()
static String Lucene::DateField::dateToString |
( |
const boost::posix_time::ptime & |
date | ) |
|
|
static |
Converts a Date to a string suitable for indexing.
◆ getClassName()
virtual String Lucene::DateField::getClassName |
( |
| ) |
|
|
inlinevirtual |
◆ MAX_DATE_STRING()
static const String& Lucene::DateField::MAX_DATE_STRING |
( |
| ) |
|
|
static |
◆ MIN_DATE_STRING()
static const String& Lucene::DateField::MIN_DATE_STRING |
( |
| ) |
|
|
static |
◆ shared_from_this()
boost::shared_ptr< DateField > Lucene::DateField::shared_from_this |
( |
| ) |
|
|
inline |
◆ stringToTime()
static int64_t Lucene::DateField::stringToTime |
( |
const String & |
s | ) |
|
|
static |
Converts a string-encoded date into a millisecond time.
◆ timeToString()
static String Lucene::DateField::timeToString |
( |
int64_t |
time | ) |
|
|
static |
Converts a millisecond time to a string suitable for indexing.
The documentation for this class was generated from the following file: