On 8/9/2013 6:12 AM, sowja...@pointcross.com wrote:
> When using SolrJ I've realized document dates are being modified according
> to the environment UTC timezone.
> 
> I have indexed the large amount of data on date fileds of Solr (using Solr
> 3.3). While retrieving this date using the SolrJ into SolrDocumentList. The
> original date value is modified.
> 
> Are we missing any setting at solrConfig. Any Help

If you are using a text date for indexing, which must be in a specific
format, then it will be interpreted as UTC, which Jack has already told you.

This is the format that Solr requires when the date for indexing is a
text string.  This is also the format that you will see in raw responses
from Solr.  The "Z" means Zulu, or UTC.  There is no way to include a
timezone when using text strings:

2013-07-03T14:08:58Z

If you index a Java date object instead of the text format, it will be
valid in the timezone at the client, and SolrJ will do timezone
translation before sending to Solr.  Solr will index/store the date in UTC.

Similarly, if you extract the date from the Solr response as a Date
object, you can see it in your local timezone.  I just tried this with
some SolrJ code that looked like this:

SolrServer srv = new HttpSolrServer("server:port/solr/corename");
SolrQuery qry = new SolrQuery();
qry.setQuery("id:idvalue");
QueryResponse rsp = srv.query(qry);
Date dt = (Date) rsp.getResults().get(0).get("date");
System.out.println(dt);

Thanks,
Shawn

Reply via email to