Chris,


Thanks for your reply. Please find the below process What we followed on Sample 
Test Solr:



Step1: Indexing data to Solr ( Schema looks like this)

<fieldType name="date" class="solr.TrieDateField" omitNorms="true" 
precisionStep="0" positionIncrementGap="0" />



<field name="441" CN="STARTDATE" type="date" indexed="true" stored="true" 
multiValued="false" />



Step2: Indexing code:

string strStartDate = "26/5/2000 8:38:16 AM";

DateTime dt = new DateTime();

dt = Convert.ToDateTime(strStartDate);

strStartDate = dt.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'");

AddField(doc, "441", strStartDate); // posting to solr.



Step3: Results from Browser

Query: 
http://localhost:8090/solrTest/select/?q=ID%3ASOLR1001&version=2.2&start=0&rows=10&indent=on&fl=441

Result:

                <doc>

                         <date name="441">2000-05-26T08:38:16Z</date>

</doc>

Step4: Results from SolrJ

       Code Snippet:

CommonsHttpSolrServer SOLRSERVER = new CommonsHttpSolrServer(strQueryURL);

              qrResponse = SOLRSERVER.query(sqUserQuery, METHOD.POST);

       Result:

              
{responseHeader={status=0,QTime=1,params={facet.mincount=1,facet.limit=-1,wt=javabin,rows=100000,version=2,fl=441,start=0,q=ID:SOLR1001}},response={numFound=1,start=0,docs=[SolrDocument[{441=Fri
 May 26 14:08:16 IST 2000}]]}}





We can see the Result in yellow marked coming (SolrJ) as in different format of 
time zone(original Date). I hope we have explained what is the issue that we 
are facing.



Thanks & Regards,

Sowjanya K



From: Chris Hostetter-3 [via Lucene] 
[mailto:ml-node+s472066n4083620...@n3.nabble.com]
Sent: 09 August 2013 23:52
To: sowja...@pointcross.com
Subject: Re: Environment Timezone considered When using SolrJ




: 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.

this is missleading -- SolrJ doesn't do any sort of "timezone translation"
... a Java Date object represents an absolute fixed moment in time, there
is no timezone information in it.  If your client code builds a Date
object from some intial string, then at the moment *you* parse hat string,
you are either explcitly or implicitly assuming some TZ information about
the string representation when converting it into an absolute moment in
time to build the Date object -- likewise, when executing a search and
fetching responses, SolrJ will give you back a Data object (representing
an absolute moment in time) and if *you* format that date as a string, you
are either explcitly or implicitly assuming some TZ information about the
string representation when converting it from a Date object (representing
that absolute moment in time)

Internally in SolrJ and Solr, Dates are always either Date objects
(representing absolute moments in times) or they are Strings or longs
representing that absolute moment in time relative to the UTC TZ
coordinate space.

Bottom line: if you are not seeing the correct "time" then some assumption
is probaly being violated somewhere in your client code as far as the
conversaion to/from string values -- if you gather up and look at:

 1) your indexing code
 2) a sample query URL done from the browser
 3) the XML/json results from that sample query in your browser
 4) your searching code excuting the same query in SolrJ
 5) the output of your SolrJ search code

...the problem may become obvious, but if not is not, then sending all of
those things in a reply will help us point out where any discrepencies
might be.


-Hoss



  _____

If you reply to this email, your message will be added to the discussion below:

http://lucene.472066.n3.nabble.com/Environment-Timezone-considered-When-using-SolrJ-tp4083497p4083620.html

To unsubscribe from Environment Timezone considered When using SolrJ, click 
here<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4083497&code=c293amFueWFAcG9pbnRjcm9zcy5jb218NDA4MzQ5N3w5MjQxMTAxNDE=>.
NAML<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>





--
View this message in context: 
http://lucene.472066.n3.nabble.com/Environment-Timezone-considered-When-using-SolrJ-tp4083497p4083947.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to