Hi Yonik, thank you very much!! Now it works very well!! The formula "numDocs() == maxDocs() - numer_of_deleted_docs" should be stand in the API! :)
Thank you again! Bye Derya > --- Ursprüngliche Nachricht --- > Von: Yonik Seeley <[EMAIL PROTECTED]> > An: java-user@lucene.apache.org > Betreff: Re: IndexReader delete(int i) > Datum: Mon, 29 Aug 2005 15:55:26 -0400 > > Perhaps because you are not iterating over all the documents? > numDocs() == maxDocs() - numer_of_deleted_docs > So first try replacing numDocs() with maxDocs() > > -Yonik > > > On 8/29/05, Derya Kasapoglu <[EMAIL PROTECTED]> wrote: > > Hi, > > > > if i delete a document from index, what does the it do? > > I want to know because if i delete documents from index which are > > not anymore in the dokument directories like that: > > > > IndexReader reader = IndexReader.open(dir); > > > > for (int i=0; i<reader.numDocs(); i++) { > > > > Document doc =reader.document(i); > > String path = doc.get("path"); > > File file = new File(path); > > > > if (!file.exists()) reader.delete(i); > > } > > > > reader.close(); > > > > the IndexReader doesn't delete all dokuments by the first run!!!! > > > > I mean if i say > > if (!file.exists()) System.out.println(path); > > i get all documents which are not in the directory but if i say > reader.delete(i) > > it deletes only a part of the documents which are not exists!!! > > If i start the application again it delets the rest, sometimes not all > of the rest, > > but if i start it again and again it deletes all documents which are not > exists. > > > > But why it doen't do it by the first run? > > Does delete() do something with the document IDs? Or something else? > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- 5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail +++ GMX - die erste Adresse für Mail, Message, More +++ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]