When you ask for a field from Solr, it returns _exactly_ what you gave it. So 
if you input contains the “Z”, the output will. You have to massage it however 
you want if you want something different. I can imagine at least 3 ways to do 
this:

1> create a second field with stored=“true”, indexed=“false”, docValues=“false” 
as a “string” type. On your real date field, make it stored=“false”. Now you 
search/group/facet/whatever on hour date field and specify tne new field in 
your “fl” list. It would be easy to do all this in a ScriptUpdateProcessor so 
your client(s) wouldn’t have to deal with it.

2> Just have your client app take the date and transform it into something more 
pleasing.

3> Use a document transformer (see “Transforming Result Documents” in the 
reference guide) to change the docs on the way out.

However, it’s a different time you’re going to show your users .vs. the actual 
time in the document. You want to take the “Z” off and/or change it to UTC+2. 
But that’s mis-informing the user about what the actual time was by 2 hours 
unless you change the value shown to reflect that.

Best,
Erick


> On Apr 8, 2019, at 3:38 AM, Miettinen Jaana (STAT) <jaana.mietti...@stat.fi> 
> wrote:
> 
> Dear recipient,
> 
> I have a problem in solr: I should add several (old) time stamps into my solr 
> documents, but all of them are in  local time (UTC+2 or UTC+3 depending on 
> day-light-saving situation). As default solr excepts all time stamps to be in 
> UTC-time and adds the 'Z'-character into the end of the time stamp-strings to 
> indicate, that the date should be considered as UTC-time.
> 
> Is it possible to change this 'Z'-notation ? Either I would want to get rid 
> of that 'Z' or change it to denote UTC+2.
> 
> I noticed that there's variable SOLR_TIMEZONE in 
> solr-7.6.0/bin/solr.in.sh-file. I changed it to  SOLR_TIMEZONE="EST", 
> re-created my solr-servers, but nothing changed. Why was that configuration 
> file ignored (I also changed the port to check whether it was ignored really) 
> ? And what is the purpose of  SOLR_TIMEZONE-variable ?
> 
> Br, Jaana Miettinen

Reply via email to