On Tue, Jan 13, 2009 at 12:53 AM, con <convo...@gmail.com> wrote: > > Hi all > > I am using solr to index data from my database. > In my database there is a timestamp field of which data will be in the form > of, > 15-09-08 06:28:38.442000000 AM. The column is of type TIMESTAMP in the > oracle db. > So in the schema.xml i have mentioned as: > <field name="LOGIN_TIMESTAMP" type="date" indexed="true" stored="true" /> > > While indexing data in the debug mode i get this timestamp value as > <arr> > <str>oracle.sql.TIMESTAMP:oracle.sql.timest...@f536e8</str> > </arr> > > And when i do a searching this value is not displaying while all other > fields indexed along with it are getting displayed.
Hmm, interesting. It seems oracle.sql.TIMESTAMP does not inherit from java.sql.Timestamp or java.util.Date. This is why DataImportHandler/Solr cannot make sense out of it and the string representation is being stored in the index. However it has a toJdbc() method which will return a Jdbc compatible object. http://download-uk.oracle.com/otn_hosted_doc/jdeveloper/904preview/jdbc-javadoc/oracle/sql/TIMESTAMP.html#toJdbc() > 1) So do i need to write a custom transformer to add these values to the > index. Yes, it seems like that is the only way. > 2)And if yes I am confused how it is? Is there a sample code somewhere? Yes, see an example here -- http://wiki.apache.org/solr/DIHCustomTransformer > > I have tried the sample TrimTransformer and it is working. But can i > convert > this string to a valid date format.(I am not a java expert..:-( )? I would start by trying something like this: oracle.jdbc.TIMESTAMP timestamp = (oracle.jdbc.TIMESTAMP) row.get("your_timestamp_field_name"); row.put("your_timestamp_field_name", timestamp.toJdbc()); > > -- > View this message in context: > http://www.nabble.com/Custom-Transformer-to-handle-Timestamp-tp21421742p21421742.html > Sent from the Solr - User mailing list archive at Nabble.com. > > -- Regards, Shalin Shekhar Mangar.