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 Chantal Ackermann <ch...@btelligent.de> on 2010/07/12 16:04:40 UTC
Copy Date Field and/or Using DateMathParser in DataImportHandler
Hi and back again,
to create a copy of my date field that holds only the date with "no
time" (=0:00h time).
The question is:
Do I have to create the new date (without time) in my own transformer
(using a Calendar object) or is there some convenient way to use the
DateMathParser during indexing time when using DataImportHandler?
I checked out:
https://issues.apache.org/jira/browse/SOLR-469
which looks like the original Jira issue tracking the DataImportHandler
development.
And http://wiki.apache.org/solr/DataImportHandler#DateFormatTransformer
and the thread:
"[solr-user] Sorting dates with reduced precision"
http://search.lucidimagination.com/search/document/f2313ffae081bf79/sorting_dates_with_reduced_precision#46566037750d7b5
In the latter, it's said:
"""
Append "/DAY" to the date value you index, for example
"1995-12-31T23:59:59Z/DAY" will yield "1995-12-31"
[...]
Thanks, this happens at indexing time?
Yes
"""
Well, I tried the most simple idea that came to my mind:
<copyField source="start_date/DAY" dest="start_day" />
but this does not work. Certainly - the slash is not a reserved
character and SOLR expects a field called "start_date/DAY", in this
case.
Is it possible to use the DateMathParser syntax to create that new field
from the existing date field or the sourcing date string?
In the Jira issue listed above I found this:
"""
A new interface called Evaluator has been added which makes it possible
to plugin new expression evaluators (for resolving variable names)
Using the same Evaluator interface, a few new evaluators have been added
formatDate - use as ${dataimporter.functions.formatDate('NOW',yyyy-MM-dd
HH:mm)}, this will format NOW as per the given format and return a
string which can be used in queries or urls. It supports the full
DateMathParser syntax. You can also format fields e.g.
${dataimporter.functions.formatDate(A.purchase_date,dd-MM-yyyy)}
"""
This is from 2008, is this still true for the current DataImportHandler?
Just looking for the best method to solve this. Any insights very much
appresciated!
Thanks,
Chantal
AW: Copy Date Field and/or Using DateMathParser in DataImportHandler
Posted by Bastian Spitzer <bs...@magix.net>.
Hm seems i didnt read the 1st part of your Question:/ Forget what i just wrote. :)
-----Ursprüngliche Nachricht-----
Von: Bastian Spitzer [mailto:bspitzer@magix.net]
Gesendet: Montag, 12. Juli 2010 16:41
An: solr-user@lucene.apache.org
Betreff: AW: Copy Date Field and/or Using DateMathParser in DataImportHandler
Hi Chantal,
where is your Solr integrated? Where is this Date comin from? I personaly wouldnt use SOLR for such conversions, ist nice if there are such built-in features, but sticking to java/.net or whatever generates your documents seems much more comfortable. In Java f.e. this is just 2 lines of code and you are done.
cheers.
-----Ursprüngliche Nachricht-----
Von: Chantal Ackermann [mailto:chantal.ackermann@btelligent.de]
Gesendet: Montag, 12. Juli 2010 16:05
An: solr-user@lucene.apache.org
Betreff: Copy Date Field and/or Using DateMathParser in DataImportHandler
Hi and back again,
to create a copy of my date field that holds only the date with "no time" (=0:00h time).
The question is:
Do I have to create the new date (without time) in my own transformer (using a Calendar object) or is there some convenient way to use the DateMathParser during indexing time when using DataImportHandler?
I checked out:
https://issues.apache.org/jira/browse/SOLR-469
which looks like the original Jira issue tracking the DataImportHandler development.
And http://wiki.apache.org/solr/DataImportHandler#DateFormatTransformer
and the thread:
"[solr-user] Sorting dates with reduced precision"
http://search.lucidimagination.com/search/document/f2313ffae081bf79/sorting_dates_with_reduced_precision#46566037750d7b5
In the latter, it's said:
"""
Append "/DAY" to the date value you index, for example "1995-12-31T23:59:59Z/DAY" will yield "1995-12-31"
[...]
Thanks, this happens at indexing time?
Yes
"""
Well, I tried the most simple idea that came to my mind:
<copyField source="start_date/DAY" dest="start_day" /> but this does not work. Certainly - the slash is not a reserved character and SOLR expects a field called "start_date/DAY", in this case.
Is it possible to use the DateMathParser syntax to create that new field from the existing date field or the sourcing date string?
In the Jira issue listed above I found this:
"""
A new interface called Evaluator has been added which makes it possible to plugin new expression evaluators (for resolving variable names) Using the same Evaluator interface, a few new evaluators have been added formatDate - use as ${dataimporter.functions.formatDate('NOW',yyyy-MM-dd
HH:mm)}, this will format NOW as per the given format and return a string which can be used in queries or urls. It supports the full DateMathParser syntax. You can also format fields e.g.
${dataimporter.functions.formatDate(A.purchase_date,dd-MM-yyyy)}
"""
This is from 2008, is this still true for the current DataImportHandler?
Just looking for the best method to solve this. Any insights very much appresciated!
Thanks,
Chantal
AW: Copy Date Field and/or Using DateMathParser in DataImportHandler
Posted by Bastian Spitzer <bs...@magix.net>.
Hi Chantal,
where is your Solr integrated? Where is this Date comin from? I personaly wouldnt use SOLR for such
conversions, ist nice if there are such built-in features, but sticking to java/.net or whatever
generates your documents seems much more comfortable. In Java f.e. this is just 2 lines of code
and you are done.
cheers.
-----Ursprüngliche Nachricht-----
Von: Chantal Ackermann [mailto:chantal.ackermann@btelligent.de]
Gesendet: Montag, 12. Juli 2010 16:05
An: solr-user@lucene.apache.org
Betreff: Copy Date Field and/or Using DateMathParser in DataImportHandler
Hi and back again,
to create a copy of my date field that holds only the date with "no time" (=0:00h time).
The question is:
Do I have to create the new date (without time) in my own transformer (using a Calendar object) or is there some convenient way to use the DateMathParser during indexing time when using DataImportHandler?
I checked out:
https://issues.apache.org/jira/browse/SOLR-469
which looks like the original Jira issue tracking the DataImportHandler development.
And http://wiki.apache.org/solr/DataImportHandler#DateFormatTransformer
and the thread:
"[solr-user] Sorting dates with reduced precision"
http://search.lucidimagination.com/search/document/f2313ffae081bf79/sorting_dates_with_reduced_precision#46566037750d7b5
In the latter, it's said:
"""
Append "/DAY" to the date value you index, for example "1995-12-31T23:59:59Z/DAY" will yield "1995-12-31"
[...]
Thanks, this happens at indexing time?
Yes
"""
Well, I tried the most simple idea that came to my mind:
<copyField source="start_date/DAY" dest="start_day" /> but this does not work. Certainly - the slash is not a reserved character and SOLR expects a field called "start_date/DAY", in this case.
Is it possible to use the DateMathParser syntax to create that new field from the existing date field or the sourcing date string?
In the Jira issue listed above I found this:
"""
A new interface called Evaluator has been added which makes it possible to plugin new expression evaluators (for resolving variable names) Using the same Evaluator interface, a few new evaluators have been added formatDate - use as ${dataimporter.functions.formatDate('NOW',yyyy-MM-dd
HH:mm)}, this will format NOW as per the given format and return a string which can be used in queries or urls. It supports the full DateMathParser syntax. You can also format fields e.g.
${dataimporter.functions.formatDate(A.purchase_date,dd-MM-yyyy)}
"""
This is from 2008, is this still true for the current DataImportHandler?
Just looking for the best method to solve this. Any insights very much appresciated!
Thanks,
Chantal