You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Benjamin Kern <be...@bkern.de> on 2013/05/21 22:31:11 UTC
Date Field
Hi all,
how can I set the time zone for a date field?
<field name="field" type="date" indexed="true" stored="true">
Thanks
Re: Date Field
Posted by Furkan KAMACI <fu...@gmail.com>.
This may help you:
http://stackoverflow.com/questions/2370171/another-datetime-question
2013/5/21 Benjamin Kern <be...@bkern.de>
> How can I convert the UTC Time?
>
> -----Ursprüngliche Nachricht-----
> Von: Alexandre Rafalovitch [mailto:arafalov@gmail.com]
> Gesendet: Dienstag, 21. Mai 2013 22:37
> An: solr-user@lucene.apache.org
> Betreff: Re: Date Field
>
> The date field is stored in UTC, absolute time. You need to convert to and
> from UTC in the client/middleware as you see fit.
>
> Regards,
> Alex.
> Personal blog: http://blog.outerthoughts.com/
> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
> - Time is the quality of nature that keeps events from happening all at
> once. Lately, it doesn't seem to be working. (Anonymous - via GTD
> book)
>
>
> On Tue, May 21, 2013 at 4:31 PM, Benjamin Kern <be...@bkern.de> wrote:
> > Hi all,
> >
> > how can I set the time zone for a date field?
> >
> > <field name="field" type="date" indexed="true" stored="true">
> >
> >
> >
> > Thanks
> >
>
>
>
Re: AW: Date Field
Posted by Chris Hostetter <ho...@fucit.org>.
: <field column=" field " xpath="/xpath " dateTimeFormat="MM/yy"/>
:
: Schema.xml
: <field name=" zielfeld " type="date" indexed="true" stored="true">
:
: Result in Solr: 2013-04-30T22:00:00Z
: I think the date should look like this: 2013-05-01T00:00:00Z
Did you check the docs? if you are using Solr prior to Solr 4.1 what you
are describing looks appropriate if your server is running on a machine
with a UTC offset of 2 hours...
http://wiki.apache.org/solr/DataImportHandler#DateFormatTransformer
-Hoss
AW: Date Field
Posted by Benjamin Kern <be...@bkern.de>.
How is the format of utc string? Example?
thx
-----Ursprüngliche Nachricht-----
Von: Chris Hostetter [mailto:hossman_lucene@fucit.org]
Gesendet: Mittwoch, 22. Mai 2013 00:03
An: solr-user@lucene.apache.org
Betreff: Re: Date Field
: 2) Chain TemplateTransformer either by itself or before the
: DateFormatTransformer (not sure if evaluator spits the date out or
: not). Either way, I think you should be able to use the formatDate
: function in the transformer
That sounds correct .. it should be possible to use TemplateTransformer (or
something like RegexTransformer) prior to DateFormatTransformer so that the
value you extract from the xpath (ie: "5/13") gets the literal string " UTC"
appended to it, and then configure a dateTimeFormat that parses the timezone
from the value (ie: "MM/yy z")
-Hoss
Re: Date Field
Posted by Chris Hostetter <ho...@fucit.org>.
: And DateFormatTransformer does not take timezone into account when it
: parses the text. A bit of a stuck situation.
Gah! .. i'm sorry about my previous response pointing to the wiki .... I
realize now that I missread the docs and replied to quickly.
Alex's response appears correct -- evidently DateFormatTransformer seems
to use the system timezone (ie: the TZ your server is running in) when
parsing dates (unless your date format actually includes a timezone
option).
: 2) Chain TemplateTransformer either by itself or before the
: DateFormatTransformer (not sure if evaluator spits the date out or
: not). Either way, I think you should be able to use the formatDate
: function in the transformer
That sounds correct .. it should be possible to use TemplateTransformer
(or something like RegexTransformer) prior to DateFormatTransformer so
that the value you extract from the xpath (ie: "5/13") gets the literal
string " UTC" appended to it, and then configure a dateTimeFormat that
parses the timezone from the value (ie: "MM/yy z")
-Hoss
Re: Date Field
Posted by Alexandre Rafalovitch <ar...@gmail.com>.
Ok, so we are talking about DataImportHandler as a client. It looks
like the only (documented) way to correct the timezone in DIH is the
evaluator http://wiki.apache.org/solr/DataImportHandler#formatDate .
However, I am not sure if evaluator can be used inside DIH.
And DateFormatTransformer does not take timezone into account when it
parses the text. A bit of a stuck situation.
I would try one of the following workarounds:
1) Write your own transformer based on DFT and picking up default
timezone setting from somewhere
2) Chain TemplateTransformer either by itself or before the
DateFormatTransformer (not sure if evaluator spits the date out or
not). Either way, I think you should be able to use the formatDate
function in the transformer
3) Create a Jira and wait (possibly for a while....)
Regards,
Alex.
Personal blog: http://blog.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all
at once. Lately, it doesn't seem to be working. (Anonymous - via GTD
book)
On Tue, May 21, 2013 at 5:19 PM, Benjamin Kern <be...@bkern.de> wrote:
> For example:
> original data: 05/13
> Reading:
> <field column=" field " xpath="/xpath " dateTimeFormat="MM/yy"/>
>
> Schema.xml
> <field name=" zielfeld " type="date" indexed="true" stored="true">
>
> Result in Solr: 2013-04-30T22:00:00Z
> I think the date should look like this: 2013-05-01T00:00:00Z
> How can I change this?
>
> Thanks
>
> -----Ursprüngliche Nachricht-----
> Von: Alexandre Rafalovitch [mailto:arafalov@gmail.com]
> Gesendet: Dienstag, 21. Mai 2013 22:45
> An: solr-user@lucene.apache.org
> Betreff: Re: Date Field
>
> This depends on what you use. If you are using SolrJ, it takes the date itself. Other clients, you may need to ensure you use Localized formatter with UTC TimeZone when you generate the text representation of the date. This is a 'client' question, not so much the 'Solr' one.
>
> Regards,
> Alex.
> Personal blog: http://blog.outerthoughts.com/
> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
> - Time is the quality of nature that keeps events from happening all at once. Lately, it doesn't seem to be working. (Anonymous - via GTD
> book)
>
>
> On Tue, May 21, 2013 at 4:39 PM, Benjamin Kern <be...@bkern.de> wrote:
>> How can I convert the UTC Time?
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Alexandre Rafalovitch [mailto:arafalov@gmail.com]
>> Gesendet: Dienstag, 21. Mai 2013 22:37
>> An: solr-user@lucene.apache.org
>> Betreff: Re: Date Field
>>
>> The date field is stored in UTC, absolute time. You need to convert to and from UTC in the client/middleware as you see fit.
>>
>> Regards,
>> Alex.
>> Personal blog: http://blog.outerthoughts.com/
>> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
>> - Time is the quality of nature that keeps events from happening all
>> at once. Lately, it doesn't seem to be working. (Anonymous - via GTD
>> book)
>>
>>
>> On Tue, May 21, 2013 at 4:31 PM, Benjamin Kern <be...@bkern.de> wrote:
>>> Hi all,
>>>
>>> how can I set the time zone for a date field?
>>>
>>> <field name="field" type="date" indexed="true" stored="true">
>>>
>>>
>>>
>>> Thanks
>>>
>>
>>
>
>
AW: Date Field
Posted by Benjamin Kern <be...@bkern.de>.
For example:
original data: 05/13
Reading:
<field column=" field " xpath="/xpath " dateTimeFormat="MM/yy"/>
Schema.xml
<field name=" zielfeld " type="date" indexed="true" stored="true">
Result in Solr: 2013-04-30T22:00:00Z
I think the date should look like this: 2013-05-01T00:00:00Z
How can I change this?
Thanks
-----Ursprüngliche Nachricht-----
Von: Alexandre Rafalovitch [mailto:arafalov@gmail.com]
Gesendet: Dienstag, 21. Mai 2013 22:45
An: solr-user@lucene.apache.org
Betreff: Re: Date Field
This depends on what you use. If you are using SolrJ, it takes the date itself. Other clients, you may need to ensure you use Localized formatter with UTC TimeZone when you generate the text representation of the date. This is a 'client' question, not so much the 'Solr' one.
Regards,
Alex.
Personal blog: http://blog.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all at once. Lately, it doesn't seem to be working. (Anonymous - via GTD
book)
On Tue, May 21, 2013 at 4:39 PM, Benjamin Kern <be...@bkern.de> wrote:
> How can I convert the UTC Time?
>
> -----Ursprüngliche Nachricht-----
> Von: Alexandre Rafalovitch [mailto:arafalov@gmail.com]
> Gesendet: Dienstag, 21. Mai 2013 22:37
> An: solr-user@lucene.apache.org
> Betreff: Re: Date Field
>
> The date field is stored in UTC, absolute time. You need to convert to and from UTC in the client/middleware as you see fit.
>
> Regards,
> Alex.
> Personal blog: http://blog.outerthoughts.com/
> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
> - Time is the quality of nature that keeps events from happening all
> at once. Lately, it doesn't seem to be working. (Anonymous - via GTD
> book)
>
>
> On Tue, May 21, 2013 at 4:31 PM, Benjamin Kern <be...@bkern.de> wrote:
>> Hi all,
>>
>> how can I set the time zone for a date field?
>>
>> <field name="field" type="date" indexed="true" stored="true">
>>
>>
>>
>> Thanks
>>
>
>
Re: Date Field
Posted by Alexandre Rafalovitch <ar...@gmail.com>.
This depends on what you use. If you are using SolrJ, it takes the
date itself. Other clients, you may need to ensure you use Localized
formatter with UTC TimeZone when you generate the text representation
of the date. This is a 'client' question, not so much the 'Solr' one.
Regards,
Alex.
Personal blog: http://blog.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all
at once. Lately, it doesn't seem to be working. (Anonymous - via GTD
book)
On Tue, May 21, 2013 at 4:39 PM, Benjamin Kern <be...@bkern.de> wrote:
> How can I convert the UTC Time?
>
> -----Ursprüngliche Nachricht-----
> Von: Alexandre Rafalovitch [mailto:arafalov@gmail.com]
> Gesendet: Dienstag, 21. Mai 2013 22:37
> An: solr-user@lucene.apache.org
> Betreff: Re: Date Field
>
> The date field is stored in UTC, absolute time. You need to convert to and from UTC in the client/middleware as you see fit.
>
> Regards,
> Alex.
> Personal blog: http://blog.outerthoughts.com/
> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
> - Time is the quality of nature that keeps events from happening all at once. Lately, it doesn't seem to be working. (Anonymous - via GTD
> book)
>
>
> On Tue, May 21, 2013 at 4:31 PM, Benjamin Kern <be...@bkern.de> wrote:
>> Hi all,
>>
>> how can I set the time zone for a date field?
>>
>> <field name="field" type="date" indexed="true" stored="true">
>>
>>
>>
>> Thanks
>>
>
>
AW: Date Field
Posted by Benjamin Kern <be...@bkern.de>.
How can I convert the UTC Time?
-----Ursprüngliche Nachricht-----
Von: Alexandre Rafalovitch [mailto:arafalov@gmail.com]
Gesendet: Dienstag, 21. Mai 2013 22:37
An: solr-user@lucene.apache.org
Betreff: Re: Date Field
The date field is stored in UTC, absolute time. You need to convert to and from UTC in the client/middleware as you see fit.
Regards,
Alex.
Personal blog: http://blog.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all at once. Lately, it doesn't seem to be working. (Anonymous - via GTD
book)
On Tue, May 21, 2013 at 4:31 PM, Benjamin Kern <be...@bkern.de> wrote:
> Hi all,
>
> how can I set the time zone for a date field?
>
> <field name="field" type="date" indexed="true" stored="true">
>
>
>
> Thanks
>
Re: Date Field
Posted by Alexandre Rafalovitch <ar...@gmail.com>.
The date field is stored in UTC, absolute time. You need to convert to
and from UTC in the client/middleware as you see fit.
Regards,
Alex.
Personal blog: http://blog.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all
at once. Lately, it doesn't seem to be working. (Anonymous - via GTD
book)
On Tue, May 21, 2013 at 4:31 PM, Benjamin Kern <be...@bkern.de> wrote:
> Hi all,
>
> how can I set the time zone for a date field?
>
> <field name="field" type="date" indexed="true" stored="true">
>
>
>
> Thanks
>
Re: Date Field
Posted by Furkan KAMACI <fu...@gmail.com>.
Did you check here:
http://lucene.apache.org/solr/4_3_0/solr-core/org/apache/solr/schema/DateField.html
2013/5/21 Benjamin Kern <be...@bkern.de>
> Hi all,
>
> how can I set the time zone for a date field?
>
> <field name="field" type="date" indexed="true" stored="true">
>
>
>
> Thanks
>
>