开发者

Lucene : IndexWriter.update - how to form term for searching numeric values

开发者 https://www.devze.com 2023-01-07 17:42 出处:网络
My index has the following fields : ID (type long, indexed, stored, not analyzed), Contents (String, not indexed, not analyzed, stored) and Tags (String, indexed, analyzed, stored).

My index has the following fields : ID (type long, indexed, stored, not analyzed), Contents (String, not indexed, not analyzed, stored) and Tags (String, indexed, analyzed, stored).

Need to update the Contents for a given ID - how to do that using IndexWriter.update? How do I form the term?

If the ID i开发者_如何转开发s stored as String I can form the Term as new Term(ID, "someID") - but will that have any other impact regarding long/String conversions etc.?


Assuming your ID is a numeric field, then have a look at the "longToPrefixCoded" function in the "NumericUtils" namespace.

Hope this helps,

0

精彩评论

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

关注公众号