tags:

views:

29

answers:

1

Hi,

I have indexed a date in lucene using DateTools.dateToString to store the date in a particular field.

Is there any way to know if this was a date field, and more importantly how to get the date out again?

It's a fieldable with a long integer value.

Thanks

+3  A: 

Lucene does not have strong-typing of fields, so the same field could have a date in one record and a string in another record, and a random integer in a third. It's up to your application to know what to look for in a particular field.

You can use the DateTools.StringToDate method to convert from a string back to a date.

Dean Harding
I gathered as much after doing some more reading and checking. Perhaps in a later version. It would just be good to know which ones are dates since they are typically handled differently to other properties.
Jim