CLucene - a full-featured, c++ search engine
API Documentation
#include <DateField.h>
Public Member Functions | |
~DateField () | |
Static Public Member Functions | |
static TCHAR * | timeToString (const int64_t time) |
Converts a millisecond time to a string suitable for indexing. | |
static void | timeToString (const int64_t time, TCHAR *str) |
Converts a millisecond time to a string suitable for indexing. | |
static int64_t | stringToTime (const TCHAR *s) |
Converts a string-encoded date into a millisecond time. |
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 RangeQuery 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 DateTools for an alternative without such a limitation.
lucene::document::DateField::~DateField | ( | ) |
static TCHAR* lucene::document::DateField::timeToString | ( | const int64_t | time | ) | [static] |
Converts a millisecond time to a string suitable for indexing.
RuntimeException | if the time specified in the method argument is negative, that is, before 1970 |
static void lucene::document::DateField::timeToString | ( | const int64_t | time, | |
TCHAR * | str | |||
) | [static] |
Converts a millisecond time to a string suitable for indexing.
CL_ERR_IllegalArgument | if the time specified in the method argument is negative, that is, before 1970 |
str | must be a character array DATEFIELD_DATE_LEN+1 or longer |
static int64_t lucene::document::DateField::stringToTime | ( | const TCHAR * | s | ) | [static] |
Converts a string-encoded date into a millisecond time.