Thanks Shawn. I stopped setting the parser as suggested.
I found that what I had to do is to just store Date objects in my documents, then, at the last minute, when building a SolrDocument to send, convert with DateField. When I Export to XML, I export to that DateField string, then convert the zulu string back to a Date object as needed. Seems to be working fine now. Many thanks Jack On Sat, Jan 12, 2013 at 10:52 PM, Shawn Heisey <s...@elyograg.org> wrote: > On 1/12/2013 7:51 PM, Jack Park wrote: >> >> My work engages SolrJ, with which I send documents off to Solr 4 which >> properly store, as viewed in the admin panel, as this example: >> 2013-02-04T02:11:39.995Z >> >> When I retrieve a document with that date, I use the SolrDocument >> returned as a Map<String,Object> in which the date now looks like >> this: >> Sun Feb 03 18:11:39 PST 2013 >> >> I am thinking that I am missing something in the SolrJ configuration, >> though it could be in how I structure the query; for now, here is the >> simplistic way I setup SolrJ: >> >> HttpSolrServer server = new HttpSolrServer(solrURL); >> server.setParser(new XMLResponseParser()) >> >> Is there something I am missing to retain dates as Solr stores them? > > > Quick note: setting the parser is NOT necessary unless you are trying to > connect radically different versions of Solr and SolrJ (1.x and 3.x/later, > to be precise), and will in fact make SolrJ slightly slower when contacting > Solr. Just let it use the default javabin parser -- it's faster. > > If your date field in Solr is an actual date type, then you should be > getting back a Date object in Java which you can manipulate in all the usual > Java ways. The format that you are seeing matches the toString() output > from a Date object: > > http://docs.oracle.com/javase/6/docs/api/java/util/Date.html#toString%28%29 > > You'll almost certainly have to cast the object so it's the right type: > > Date dateField = (Date) doc.get("datefieldname"); > > Thanks, > Shawn >