Why not add an LongField to store the real id, and retrieve it directly by Document.get('real id field name').
lubin ------------------ Original ------------------ From: "Sven Teichmann";<s.teichm...@s4ip.de>; Date: Tue, May 6, 2014 04:33 PM To: "java-user"<java-user@lucene.apache.org>; Subject: Best practice to map Lucene docids to real ids Hi, what is the best way to retrieve our "real" ids (as they are in our database) while searching? Right now we generate a file after indexing which contains all Lucene docids and the matching id in our database. Our own Collector converts the docids to our ids while collecting. This works as long as no document is deleted and the index optimized after it. Is this a good solution or should we use Fields or DocValues for this? What is the fastest solution? Regards, Sven Teichmann --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org .