You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2013/01/07 20:06:30 UTC
[Solr Wiki] Update of "DataImportHandler" by JamesDyer
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The "DataImportHandler" page has been changed by JamesDyer:
http://wiki.apache.org/solr/DataImportHandler?action=diff&rev1=334&rev2=335
Comment:
SOLR-2201: formatDate evaluator support for Timezones
While the namespace concept is useful , the user may want to put some computed value into the query or url for example there is a Date object and your datasource accepts Date in some custom format.
=== formatDate ===
- . Use this to format dates as strings. It takes three parameters (prior to Solr 4.1, it takes two):
+ . Use this to format dates as strings. It takes four parameters (prior to Solr 4.1, it takes two):
1. A variable that refers to a date, or a datemath expression.
1. A date format string. See java.text.SimpleDateFormat javadoc for valid date formats. (Solr 4.1 and later, this must be enclosed in single quotes. Solr 1.4 - 4.0, quotes are optional. Prior to Solr 1.4, this must not be enclosed in single quotes)
1. <!> [[Solr4.1]] (optional) The locale code to use when formatting dates, enclosed in single quotes. See java.util.Locale javadoc for details. If omitted, this defaults to the ROOT Locale. (Note: prior to Solr 4.1, formatDate would always use the current machine's default locale.)
+ 1. <!> [[Solr4.1]] (optional) The timezone code or description. See java.util.TimeZone#getTimeZone javadocs for details. If omitted, this defaults to the current machine's (JVM) timezone. If specified, the Locale must also be present in the third parameter.
* example using a variable: `'${dataimporter.functions.formatDate(item.ID, 'yyyy-MM-dd HH:mm')}'`
* example using a datemmath expression: `'${dataimporter.functions.formatDate('NOW-3DAYS', 'yyyy-MM-dd HH:mm')}'`
* example specifying a Locale: <!> [[Solr4.1]] `'${dataimporter.functions.formatDate(item.ID, 'yyyy-MM-dd HH:mm', 'th_TH')}'`
+ * example specifying a Timezone: <!> [[Solr4.1]] `'${dataimporter.functions.formatDate(item.ID, 'yyyy-MM-dd HH:mm', 'en_US', 'GMT-8:00')}'`
=== escapeSql ===
Use this to escape special sql characters . eg : `'${dataimporter.functions.escapeSql(item.ID)}'`. Takes only one argument and must be a valid value in the !VaraiableResolver.