开发者

Get a Date object out of Lucene Document

开发者 https://www.devze.com 2023-01-10 07:22 出处:网络
I have indexed a date in lucene using DateTools.dateToString to store the date in a particular field.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消