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 kostali hassan <me...@gmail.com> on 2016/07/15 18:42:59 UTC

index sql databases

I use solr5.4.1 when a attribute the type date is null (0000:00:00) the
processus of indexation stop and the log had an Error , how i have to
change in driver="com.mysql.jdbc.Driver" to ignore null date;
Last question how to set
<field column="date_nais" name="date_nais_dt"
dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss'Z'" />

to to field date<yyyy-MM-dd> and time< hh:mm:ss>

Re: index sql databases

Posted by Shawn Heisey <ap...@elyograg.org>.
On 7/19/2016 4:56 AM, kostali hassan wrote:
> I am looking for display for each user: l'utilisateur est cr�e le
> $date � $time not $document-> name est cr�e le $document->created 

You'll have to do that in your application that queries Solr, splitting
the date and time information that it receives in one field, or you'll
have to write a plugin for Solr that overrides the normal output into
two fields.  The first option is likely much easier.

Thanks,
Shawn


Re: index sql databases

Posted by kostali hassan <me...@gmail.com>.
I am looking for display for each user:
l'utilisateur est crée le $date à $time
not
$document-> name est crée le $document->created

2016-07-18 16:48 GMT+01:00 Erick Erickson <er...@gmail.com>:

> I don't see how that relates to the original
> question.
>
> bq: when I display the field type date I get the
> value in this forme yyyy-MM-dd'T'hh:mm:ss'Z'
>
> A regex in the _input_ side will have
> no effect on what Solr returns. You'd have
> to use a DocTransformer to change the output
> on the query side. DIH is in the indexing side.
>
> Best,
> Erick
>
> On Mon, Jul 18, 2016 at 2:45 AM, kostali hassan
> <me...@gmail.com> wrote:
> > can we use transformer="RegexTransformer"
> > and set in db_data_config.xml
> >  <field column="created" name="creer_dt" regex="(*)T(*)Z"
> > groupNames="date_t,time_t" />
> >
> > 2016-07-16 18:18 GMT+01:00 Shawn Heisey <ap...@elyograg.org>:
> >
> >> On 7/15/2016 3:10 PM, kostali hassan wrote:
> >> > Thank you Shawn the prb is when I display the field type date I get
> >> > the value in this forme yyyy-MM-dd'T'hh:mm:ss'Z'
> >>
> >> Solr only displays ISO date format for date fields -- an example is
> >> 2016-07-16T18:17:08.497Z -- and only in the UTC timezone.  If you want
> >> something else in your application, you'll have to translate it, or
> >> you'll have to write a custom plugin to add to Solr that changes the
> >> output format.
> >>
> >> Thanks,
> >> Shawn
> >>
> >>
>

Re: index sql databases

Posted by Erick Erickson <er...@gmail.com>.
I don't see how that relates to the original
question.

bq: when I display the field type date I get the
value in this forme yyyy-MM-dd'T'hh:mm:ss'Z'

A regex in the _input_ side will have
no effect on what Solr returns. You'd have
to use a DocTransformer to change the output
on the query side. DIH is in the indexing side.

Best,
Erick

On Mon, Jul 18, 2016 at 2:45 AM, kostali hassan
<me...@gmail.com> wrote:
> can we use transformer="RegexTransformer"
> and set in db_data_config.xml
>  <field column="created" name="creer_dt" regex="(*)T(*)Z"
> groupNames="date_t,time_t" />
>
> 2016-07-16 18:18 GMT+01:00 Shawn Heisey <ap...@elyograg.org>:
>
>> On 7/15/2016 3:10 PM, kostali hassan wrote:
>> > Thank you Shawn the prb is when I display the field type date I get
>> > the value in this forme yyyy-MM-dd'T'hh:mm:ss'Z'
>>
>> Solr only displays ISO date format for date fields -- an example is
>> 2016-07-16T18:17:08.497Z -- and only in the UTC timezone.  If you want
>> something else in your application, you'll have to translate it, or
>> you'll have to write a custom plugin to add to Solr that changes the
>> output format.
>>
>> Thanks,
>> Shawn
>>
>>

Re: index sql databases

Posted by kostali hassan <me...@gmail.com>.
can we use transformer="RegexTransformer"
and set in db_data_config.xml
 <field column="created" name="creer_dt" regex="(*)T(*)Z"
groupNames="date_t,time_t" />

2016-07-16 18:18 GMT+01:00 Shawn Heisey <ap...@elyograg.org>:

> On 7/15/2016 3:10 PM, kostali hassan wrote:
> > Thank you Shawn the prb is when I display the field type date I get
> > the value in this forme yyyy-MM-dd'T'hh:mm:ss'Z'
>
> Solr only displays ISO date format for date fields -- an example is
> 2016-07-16T18:17:08.497Z -- and only in the UTC timezone.  If you want
> something else in your application, you'll have to translate it, or
> you'll have to write a custom plugin to add to Solr that changes the
> output format.
>
> Thanks,
> Shawn
>
>

Re: index sql databases

Posted by Shawn Heisey <ap...@elyograg.org>.
On 7/15/2016 3:10 PM, kostali hassan wrote:
> Thank you Shawn the prb is when I display the field type date I get
> the value in this forme yyyy-MM-dd'T'hh:mm:ss'Z'

Solr only displays ISO date format for date fields -- an example is
2016-07-16T18:17:08.497Z -- and only in the UTC timezone.  If you want
something else in your application, you'll have to translate it, or
you'll have to write a custom plugin to add to Solr that changes the
output format.

Thanks,
Shawn


Re: index sql databases

Posted by kostali hassan <me...@gmail.com>.
Thank you Shawn the prb is when I display the field type date I get the
value in this forme yyyy-MM-dd'T'hh:mm:ss'Z'

Re: index sql databases

Posted by Shawn Heisey <ap...@elyograg.org>.
On 7/15/2016 12:42 PM, kostali hassan wrote:
> I use solr5.4.1 when a attribute the type date is null (0000:00:00)
> the processus of indexation stop and the log had an Error , how i have
> to change in driver="com.mysql.jdbc.Driver" to ignore null date; Last
> question how to set <field column="date_nais" name="date_nais_dt"
> dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss'Z'" /> to to field
> date<yyyy-MM-dd> and time< hh:mm:ss>

An all-zero date is NOT a null date.  This is a valid date for MySQL,
but it is not a valid date for Solr, and Solr will complain about it.

You need to add a parameter to your JDBC URL to set zero dates to null,
so the field will not be present in the Solr document.  I am using this
parameter in my URL definition:

   
url="jdbc:mysql://${dih.request.dbHost}:3306/${dih.request.dbSchema}?zeroDateTimeBehavior=convertToNull"

I have no idea what you are trying to do with that <field> tag.  If the
MySQL field is a date/time field, JDBC will typically put it into the
correct format for Solr date field types.  About the only thing that
mightgo wrong is timezones -- you may need to explicitly set the
timezone with MySQL url parameters.

Thanks,
Shawn