lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Becker <>
Subject Iterating through all documents indexed
Date Wed, 09 Jul 2003 06:16:39 GMT
And another one...

It seems a reoccuring question but I can't figure out how to do a proper 
update of an index. The problem I have is iterating through all 
documents -- I can think of a few hacks for this but there seems to be 
no way to just get an iterator/enumeration of all documents. This bit of 
code seems to work:

            IndexReader reader =;
            for(int i = 0; i < reader.maxDoc(); i++) {
                Document doc = reader.document(i);
                if(doc != null) {
                   // check if up-to-date, fix if required

but I am a bit suspicious about what happens when I start deleting 
documents from the index. Is this ok? Are there better ways?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message