CLucene - a full-featured, c++ search engine
API Documentation


lucene::document::DateField Class Reference

Provides support for converting dates to strings and vice-versa. More...

#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.


Detailed Description

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 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.

Deprecated:
If you build a new index, use DateTools instead. This class is included for use with existing indices and will be removed in a future release.

Constructor & Destructor Documentation

lucene::document::DateField::~DateField (  ) 


Member Function Documentation

static TCHAR* lucene::document::DateField::timeToString ( const int64_t  time  )  [static]

Converts a millisecond time to a string suitable for indexing.

Exceptions:
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.

Exceptions:
CL_ERR_IllegalArgument if the time specified in the method argument is negative, that is, before 1970
Parameters:
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.


The documentation for this class was generated from the following file:

clucene.sourceforge.net