Hi,

I'm a little confused on how either solrj is working or how solr is working.  

I'm using solr 1.4.

@Test (groups = {"integration"}, enabled = true)
   public void testDate() throws Exception
   {
      SolrServer solr = 
SolrServerFactory.getStreamingUpdateSolrServer(searchDataIngestConfiguration.getSolrURL(solrConfigurationName),
 1, 1);

      // LicenseWindowStart 2010-01-21
      String result = SolrDocumentHelper.convertLongToSolrDate(1264057200000L);
      System.out.println(result);

      SolrInputDocument document = new SolrInputDocument();
      document.addField("created", result);
      UpdateResponse updateResponse = solr.add(document);
      solr.commit();

      SolrQuery parameters = new SolrQuery();
      parameters.set("q", "*.*");
      QueryResponse queryResponse = solr.query(parameters);
      SolrDocumentList list = queryResponse.getResults();
      java.util.Date date = 
(java.util.Date)(list.get(0).getFieldValue("created"));
      System.out.println(date.getTime());
      System.out.println(new DateTime(date.getTime()));
   }

1264057200000L // What I pass to solr
2010-01-21T00:00:00Z // What I pass to solr
1264032000000 // What I get back -- 7 hour difference from my original time
2010-01-20T17:00:00.000-07:00 // What I get Back
2010-06-29T15:54:43.855-06:00 // My current time

So essentially solr is giving me a java.util.Date back converted to my local 
time zone but not really.

On my box if I run
> date
> Tue Jun 29 15:47:49 MDT 2010

So why is solr doing a -7 hour conversion when I'm -6?

I also tried running solr on a jdk 1.5 and I get the same result.

Thanks,

Neil



Reply via email to