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 = IndexReader.open(this.indexLocation);
           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?

Peter


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to