Get a Date object out of Lucene Document
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 thi开发者_Go百科s was a date field, and more importantly how to get the date out again?
It's a fieldable with a long integer value.
Thanks
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.
精彩评论