lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shalin Shekhar Mangar <shalinman...@gmail.com>
Subject Re: Invalid_Date_String on posting XML to the index
Date Thu, 16 Apr 2009 08:50:29 GMT
On Thu, Apr 16, 2009 at 1:45 PM, Mark Allan <mark.allan@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.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message