lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chantal Ackermann <chantal.ackerm...@btelligent.de>
Subject Copy Date Field and/or Using DateMathParser in DataImportHandler
Date Mon, 12 Jul 2010 14:04:40 GMT
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




Mime
View raw message