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 Aman Tandon <am...@gmail.com> on 2014/10/30 09:39:13 UTC

issue related to blank value in datefield

Hi,

I wants to set 0000-00-00T00:00:00Z value for date field where I do not
have the value. When the index the at field with value as desired it is
getting indexed as 0002-11-30T00:00:00Z.

What is the reason behind this?

With Regards
Aman Tandon

Re: issue related to blank value in datefield

Posted by Aman Tandon <am...@gmail.com>.
Thanks Chris

With Regards
Aman Tandon

On Fri, Oct 31, 2014 at 5:45 AM, Chris Hostetter <ho...@fucit.org>
wrote:

>
> : I was just trying to index the fields returned by my msql and i found
> this
>
> If you are importing dates from MySql where you have 0000-00-00T00:00:00Z
> as the default value, you should actaully be getting an error lsat time i
> checked, but this explains the right way to tell the MySQL JDBC driver not
> to give you those values ...
>
>
> https://wiki.apache.org/solr/DataImportHandlerFaq#Invalid_dates_.28e.g._.220000-00-00.22.29_in_my_MySQL_database_cause_my_import_to_abort
>
> (even if you aren't using DIH to talk to MySQL, the same principle holds
> if you are using JDBC, if you are talking to MySQL from some other client
> langauge there should be a similar option)
>
> : Actually i just want to know why it is getting stored as '
> :  0002-11-30T00:00:00Z' on indexing the value 0000-00-00T00:00:00Z.
>
> like i said: bugs. behavior with "Year 0000" is ndefined in alot of the
> underlying date code.  as for what that speciic date? ... no idea.
>
>
> -Hoss
> http://www.lucidworks.com/
>

Re: issue related to blank value in datefield

Posted by Chris Hostetter <ho...@fucit.org>.
: I was just trying to index the fields returned by my msql and i found this

If you are importing dates from MySql where you have 0000-00-00T00:00:00Z 
as the default value, you should actaully be getting an error lsat time i 
checked, but this explains the right way to tell the MySQL JDBC driver not 
to give you those values ...

https://wiki.apache.org/solr/DataImportHandlerFaq#Invalid_dates_.28e.g._.220000-00-00.22.29_in_my_MySQL_database_cause_my_import_to_abort

(even if you aren't using DIH to talk to MySQL, the same principle holds 
if you are using JDBC, if you are talking to MySQL from some other client 
langauge there should be a similar option)

: Actually i just want to know why it is getting stored as '
:  0002-11-30T00:00:00Z' on indexing the value 0000-00-00T00:00:00Z.

like i said: bugs. behavior with "Year 0000" is ndefined in alot of the 
underlying date code.  as for what that speciic date? ... no idea.


-Hoss
http://www.lucidworks.com/

Re: issue related to blank value in datefield

Posted by Aman Tandon <am...@gmail.com>.
Hi Chris,

Thanks for replying.

but if your goal, as you said, is to index 0000-00-00T00:00:00Z for
> documenst that have no value in the date field -- i have to ask why?


I was just trying to index the fields returned by my msql and i found this
issue. So i asked in the group. Sorry for writing a confusing mail.
Actually i just want to know why it is getting stored as '
 0002-11-30T00:00:00Z' on indexing the value 0000-00-00T00:00:00Z.

Is it somewhere pre-defined?

With Regards
Aman Tandon

On Thu, Oct 30, 2014 at 11:17 PM, Chris Hostetter <ho...@fucit.org>
wrote:

>
> Solr has never really owrked well with years prior to "1" because the
> specs for how they should be formated/parsed -- in particular realted to
> "year 0" have always been painfully ambiguious/contradictory.
>
> https://issues.apache.org/jira/browse/SOLR-2773
>
> If you are really trying to deal with "year 0" and dates that are "BC"
> then the current TrieDateField code probably isn't going to work well for
> you -- but if your goal, as you said, is to index 0000-00-00T00:00:00Z for
> documenst that have no value in the date field -- i have to ask why?
>
> the best solution is to not index anything in that field for those
> documents -- that will should give you the optimal behavior in all
> situations (queries, faceting, returned documents, etc...)
>
> so why do you want to put 0000-00-00T00:00:00Z in these documents?
>
> https://people.apache.org/~hossman/#xyproblem
> XY Problem
>
> Your question appears to be an "XY Problem" ... that is: you are dealing
> with "X", you are assuming "Y" will help you, and you are asking about "Y"
> without giving more details about the "X" so that we can understand the
> full issue.  Perhaps the best solution doesn't involve "Y" at all?
> See Also: http://www.perlmonks.org/index.pl?node_id=542341
>
>
>
>
> : Date: Thu, 30 Oct 2014 14:09:13 +0530
> : From: Aman Tandon <am...@gmail.com>
> : Reply-To: solr-user@lucene.apache.org
> : To: "solr-user@lucene.apache.org" <so...@lucene.apache.org>
> : Subject: issue related to blank value in datefield
> :
> : Hi,
> :
> : I wants to set 0000-00-00T00:00:00Z value for date field where I do not
> : have the value. When the index the at field with value as desired it is
> : getting indexed as 0002-11-30T00:00:00Z.
> :
> : What is the reason behind this?
> :
> : With Regards
> : Aman Tandon
> :
>
> -Hoss
> http://www.lucidworks.com/
>

Re: issue related to blank value in datefield

Posted by Chris Hostetter <ho...@fucit.org>.
Solr has never really owrked well with years prior to "1" because the 
specs for how they should be formated/parsed -- in particular realted to 
"year 0" have always been painfully ambiguious/contradictory.

https://issues.apache.org/jira/browse/SOLR-2773

If you are really trying to deal with "year 0" and dates that are "BC" 
then the current TrieDateField code probably isn't going to work well for 
you -- but if your goal, as you said, is to index 0000-00-00T00:00:00Z for 
documenst that have no value in the date field -- i have to ask why?

the best solution is to not index anything in that field for those 
documents -- that will should give you the optimal behavior in all 
situations (queries, faceting, returned documents, etc...) 

so why do you want to put 0000-00-00T00:00:00Z in these documents?

https://people.apache.org/~hossman/#xyproblem
XY Problem

Your question appears to be an "XY Problem" ... that is: you are dealing
with "X", you are assuming "Y" will help you, and you are asking about "Y"
without giving more details about the "X" so that we can understand the
full issue.  Perhaps the best solution doesn't involve "Y" at all?
See Also: http://www.perlmonks.org/index.pl?node_id=542341




: Date: Thu, 30 Oct 2014 14:09:13 +0530
: From: Aman Tandon <am...@gmail.com>
: Reply-To: solr-user@lucene.apache.org
: To: "solr-user@lucene.apache.org" <so...@lucene.apache.org>
: Subject: issue related to blank value in datefield
: 
: Hi,
: 
: I wants to set 0000-00-00T00:00:00Z value for date field where I do not
: have the value. When the index the at field with value as desired it is
: getting indexed as 0002-11-30T00:00:00Z.
: 
: What is the reason behind this?
: 
: With Regards
: Aman Tandon
: 

-Hoss
http://www.lucidworks.com/