lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Riccardo Daviddi <rdavi...@gmail.com>
Subject Re: Add unique id to a doc
Date Thu, 21 Jul 2005 17:39:47 GMT
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 delete a doc what happen?
there is a reordering of the docs inside the index? I don't know, I am
asking you that. couse if there is a reorder at the next doc to add,
if i call maxdoc this doc receive 5 again and it's not correct. for
that you said db way is safer?
thx

On 7/21/05, Otis Gospodnetic <otis_gospodnetic@yahoo.com> wrote:
> 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 <rdaviddi@gmail.com> wrote:
> 
> > 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 and get so a unique id (the key of the row in
> > the db) and use it as the unique id for the keyword field in the
> > index?
> >
> > --
> > Riccardo Daviddi
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 


-- 
Riccardo Daviddi

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message