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 Giovanni De Stefano <gi...@gmail.com> on 2009/03/27 15:47:07 UTC

Solr date parsing issue

Hello,

I am having a problem indexing a date field.

In my schema the date field is defined the standard way:

<fieldType name="date" class="solr.DateField" sortMissingLast="true"
omitNorms="true"/>

I know the Solr format is 1995-12-31T23:59:59Z, but the dates coming from my
"sources" are in the format 2009-04-10T02:02:55+0200

How can I make the conversion?

Do I have to extend DateField or is there any cleaner way to do it?

Thanks in advance!

Giovanni

Re: Solr date parsing issue

Posted by Giovanni De Stefano <gi...@gmail.com>.
Hello,

yes, I use both: I have a multicore architecture, multiple indexes but I
have been able to manage a common schema.

Giovanni


On 3/27/09, Shalin Shekhar Mangar <sh...@gmail.com> wrote:
>
> On Sat, Mar 28, 2009 at 12:46 AM, Giovanni De Stefano <
> giovanni.destefano@gmail.com> wrote:
>
> > Hello,
> >
> > the problem is that I use both Solrj and DIH but I would like to perform
> > such a change only in 1 place.
> >
> > Is there any way to do it? Otherwise I will stick with the other
> > approach...
> >
>
> Which of them are you using for adding documents? Both?
>
> --
> Regards,
> Shalin Shekhar Mangar.
>

Re: Solr date parsing issue

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Sat, Mar 28, 2009 at 12:46 AM, Giovanni De Stefano <
giovanni.destefano@gmail.com> wrote:

> Hello,
>
> the problem is that I use both Solrj and DIH but I would like to perform
> such a change only in 1 place.
>
> Is there any way to do it? Otherwise I will stick with the other
> approach...
>

Which of them are you using for adding documents? Both?

-- 
Regards,
Shalin Shekhar Mangar.

Re: Solr date parsing issue

Posted by Giovanni De Stefano <gi...@gmail.com>.
Hello,

the problem is that I use both Solrj and DIH but I would like to perform
such a change only in 1 place.

Is there any way to do it? Otherwise I will stick with the other approach...

Cheers,
Giovanni


On 3/27/09, Shalin Shekhar Mangar <sh...@gmail.com> wrote:
>
> On Fri, Mar 27, 2009 at 8:17 PM, Giovanni De Stefano <
> giovanni.destefano@gmail.com> wrote:
>
> > Hello,
> >
> > I am having a problem indexing a date field.
> >
> > In my schema the date field is defined the standard way:
> >
> > <fieldType name="date" class="solr.DateField" sortMissingLast="true"
> > omitNorms="true"/>
> >
> > I know the Solr format is 1995-12-31T23:59:59Z, but the dates coming from
> > my
> > "sources" are in the format 2009-04-10T02:02:55+0200
> >
> > How can I make the conversion?
> >
>
> If you are using Solrj then parse it into a Date object and add it. Solrj
> will take care of writing it out in the correct format.
>
> If you are using DataImportHandler then use the DateFormatTransformer.
> --
> Regards,
> Shalin Shekhar Mangar.
>

Re: Solr date parsing issue

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Fri, Mar 27, 2009 at 8:17 PM, Giovanni De Stefano <
giovanni.destefano@gmail.com> wrote:

> Hello,
>
> I am having a problem indexing a date field.
>
> In my schema the date field is defined the standard way:
>
> <fieldType name="date" class="solr.DateField" sortMissingLast="true"
> omitNorms="true"/>
>
> I know the Solr format is 1995-12-31T23:59:59Z, but the dates coming from
> my
> "sources" are in the format 2009-04-10T02:02:55+0200
>
> How can I make the conversion?
>

If you are using Solrj then parse it into a Date object and add it. Solrj
will take care of writing it out in the correct format.

If you are using DataImportHandler then use the DateFormatTransformer.
-- 
Regards,
Shalin Shekhar Mangar.