You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Bill Bell <bi...@gmail.com> on 2012/04/21 05:42:07 UTC

Question concerning date fields

We are loading a long (number of seconds since 1970?) value into Solr using java and Solrj. What is the best way to convert this into the right Solr date fields?

Sent from my Mobile device
720-256-8076

Re: Question concerning date fields

Posted by Gora Mohanty <go...@mimirtech.com>.
On 21 April 2012 09:12, Bill Bell <bi...@gmail.com> wrote:
> We are loading a long (number of seconds since 1970?) value into Solr using java and Solrj. What is the best way to convert this into the right Solr date fields?
[...]

There are various options, depending on the source of
your data, and how you are indexing the field into Solr:
* If you are fetching the no. of seconds from a database,
  most DBs will have date-conversion functions that you
  can use in the SELECT statement.
* If you are using SolrJ, java.sql.Date has a constructor
  from milli-seconds since the Unix epoch.
* If you are using DIH, you can use a transformer to
  convert the number of seconds to a date.

Regards,
Gora