lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Derya Kasapoglu <>
Subject IndexReader delete(int i)
Date Mon, 29 Aug 2005 18:29:50 GMT

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 =;

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); 


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:
For additional commands, e-mail:

View raw message