On Thu, Apr 16, 2009 at 1:45 PM, Mark Allan <mark.al...@ed.ac.uk> wrote:

>
> Hi, thanks for your prompt reply.  I'm a bit confused though - the only way
> to do this is a two-step process?
>
> I have to write code to munge the XML into another document which is
> exactly the same except for the format of the Date field, and then import
> that second file?  Isn't that the whole purpose of having an analyzer with
> the solr.PatternReplaceFilterFactory filters?  What's odd is that the
> pattern replacement works if I store the field as text but not as a date.
>  Are you sure this isn't a bug?
>

Analyzers are applied only for the indexed value but not the stored value. A
value which is added to DateField is converted to the same internal format
(for both indexing and storing purposes) and then added to the index. The
DateField#toInternal method is the one which is attempting to parse the
string into a date and failing when the field is created.

There is another option. You could create a class which extends DateField
and overrides toInternal(String) to do the conversion. You can specify this
class in the schema.xml instead of DateField.

-- 
Regards,
Shalin Shekhar Mangar.

Reply via email to