hehe, it is xmas, time to play fire. Merry Christmas to Lucene!!
On Wed, Dec 24, 2008 at 9:59 PM, Erick Erickson <erickerick...@gmail.com>wrote: > You're really, really playing with fire here. Your document IDs may > change, and in fact *will* change if you delete a document and > then optimize. Say you index 100 docs, delete number 50 and > optimize. Documents that originally had IDs 51-100 will now have > IDs 50-99 and your hierarchy will be messed up. > > And saying "I'll never delete and then optimize" is just asking for > trouble <G>... > > So just make your own ID that don't change and use *that* to > maintain your hierarchy. You can get at these pretty efficiently with > TermDocs/TermEnum and could, say at startup, read your unique > IDs into a map along with their current Lucene ID if you really care > that much about speed. This could just be a simple counter and > you could find the maximum one currently in your index when you > needed to add more documents to the index using the methods > I mentioned. > > Best > Erick > > On Wed, Dec 24, 2008 at 8:35 AM, Ian Vink <ianv...@gmail.com> wrote: > > > I am building up an index with documents that are hierarchical in their > > relationship to each other. After I insert a Document into the index, how > > do > > I know its document ID? I need that to pass to the next document as the > > "ParentID" > > Ian > > > -- www.5dinfo.net