13.05.2014 Views

apache-solr-ref-guide-4.6.pdf

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The <strong>ref</strong>reshInterval is minutes, so the above example will download the newest rates every 60 minutes.<br />

Working with Dates<br />

Date Formatting<br />

Solr's TrieDateField (and deprecated DateField) represents a point in time with millisecond precision. The format used is a restricted form<br />

of the canonical representation of dateTime in the XML Schema specification:<br />

YYYY-MM-DDThh:mm:ssZ<br />

YYYY is the year.<br />

MM is the month.<br />

DD is the day of the month.<br />

hh is the hour of the day as on a 24-hour clock.<br />

mm is minutes.<br />

ss is seconds.<br />

Z is a literal 'Z' character indicating that this string representation of the date is in UTC<br />

Note that no time zone can be specified; the String representations of dates is always expressed in Coordinated Universal Time (UTC). Here is an<br />

example value:<br />

1972-05-20T17:33:18Z<br />

You can optionally include fractional seconds if you wish, although trailing zeros are not allowed and any precision beyond milliseconds will be<br />

ignored. Here are examples value with sub-seconds include:<br />

Date Math<br />

1972-05-20T17:33:18.772Z<br />

1972-05-20T17:33:18.77Z<br />

1972-05-20T17:33:18.7Z<br />

Solr's date field types also supports date math expressions, which makes it easy to create times relative to fixed moments in time, include the<br />

current time which can be represented using the special value of " NOW".<br />

Date Math Syntax<br />

Date math expressions consist either adding some quantity of time in a specified unit, or rounding the current time by a specified unit. expressions<br />

can be chained and are evaluated left to right.<br />

For example: this represents a point in time two months from now:<br />

NOW+2MONTHS<br />

This is one day ago:<br />

NOW-1DAY<br />

A slash is used to indicate rounding. This represents the beginning of the current hour:<br />

NOW/HOUR<br />

The following example computes (with millisecond precision) the point in time six months and three days into the future and then rounds that time<br />

to the beginning of that day:<br />

NOW+6MONTHS+3DAYS/DAY<br />

Note that while date math is most commonly used relative to NOW it can be applied to any fixed moment in time as well:<br />

1972-05-20T17:33:18.772Z+6MONTHS+3DAYS/DAY<br />

Request Parameters That Affect Date Math<br />

Apache Solr Reference Guide 4.6<br />

34

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!