Re: Add unique id to a doc

2005-07-22 Thread Riccardo Daviddi
I 'll take a look at it, thx. On 7/22/05, Peter Friend <[EMAIL PROTECTED]> wrote: > > On Jul 21, 2005, at 8:53 AM, Riccardo Daviddi wrote: > > > it's possible to set an unique id (as keyword field) to a doc by > > looking in the index? I mean, it's possible to look in the index and > > know what

Re: Add unique id to a doc

2005-07-21 Thread Peter Friend
On Jul 21, 2005, at 8:53 AM, Riccardo Daviddi wrote: it's possible to set an unique id (as keyword field) to a doc by looking in the index? I mean, it's possible to look in the index and know what is the last id (which is a keyword field) and then decide for the new id to associate to the new i

Re: Add unique id to a doc

2005-07-21 Thread Riccardo Daviddi
yes I was wondering if I could "use" lucene before the db. What you mean with GUID? About the digest, well it's a possibility but considering I have to store my docs in a db I think the best is abort this and first of all store in db the doc and assign the key as unique id in the index. On 7/21/05

Re: Add unique id to a doc

2005-07-21 Thread Erik Hatcher
On Jul 21, 2005, at 3:43 PM, Riccardo Daviddi wrote: What I want to to is to assign a unique id to each doc I add to the index. I was wondering if there is a method to assign a unique id directly looking in the index so after I could store my doc in a db with the same id as key. So first Luc

Re: Add unique id to a doc

2005-07-21 Thread Riccardo Daviddi
What I want to to is to assign a unique id to each doc I add to the index. I was wondering if there is a method to assign a unique id directly looking in the index so after I could store my doc in a db with the same id as key. On 7/21/05, Erik Hatcher <[EMAIL PROTECTED]> wrote: > You could certai

Re: Add unique id to a doc

2005-07-21 Thread Riccardo Daviddi
I think maxDoc doesn't sole my problem at all. Correct me if I am wrong: suppose I have 5 docs in my index, and I wanto to add one new doc to the index. if I use the maxDoc as the new unique id for that document I obtain 5 (the first free position, considering it starts from 0). Now suppose I delet

Re: Add unique id to a doc

2005-07-21 Thread Erik Hatcher
You could certainly use IndexReader to get the last document in the index and retrieve its ID, but why? What use case do you have in mind for such id's? Do they have a non- arbitrary meaning? Do your documents have nothing unique to identify them already? Erik On Jul 21, 2005, at 1

Re: Add unique id to a doc

2005-07-21 Thread Otis Gospodnetic
Going the DB way may be safer. But you could use IndexReader's maxDoc() method to use the other approach: http://lucene.apache.org/java/docs/api/org/apache/lucene/index/IndexReader.html#maxDoc() Otis --- Riccardo Daviddi <[EMAIL PROTECTED]> wrote: > Hi all, > > it's possible to set an unique id

Add unique id to a doc

2005-07-21 Thread Riccardo Daviddi
Hi all, it's possible to set an unique id (as keyword field) to a doc by looking in the index? I mean, it's possible to look in the index and know what is the last id (which is a keyword field) and then decide for the new id to associate to the new indexed doc? Or it's better store the doc in a db