Lucene: assigning custom ids?
Can I assign my custom ids to Lucene indexed documents instead of automatically generate new ids ?
I'm asking this bec开发者_JAVA百科ause I already have ids in my collection. A specific field is used for that.
thanks
Yes - in fact this is the only way to do it. (Lucene can't generate IDs for you. The thing that it calls "doc IDs" are internal only and are subject to change at Lucene's whim.)
You would just have a field called "myID" or whatever, and mark it as stored.
精彩评论