This could be off topic, but I made something that updates indices that worked like the following, wonder if anybody has the same ideas? I found something like IndexAccessControl in the mailing list before. An implementation of the following uses IAC.
ManagedIndex index = ManagedIndex.getInstance(configuration); // could return different implemetnations of the ManagedIndex Searcher searcher = index.getSearcher(); // could return different implementations of Searcher ManagedUpdateSession session = index.beginUpdate(); // start a update session session.addDocument(...); // use session to add, delete, update documents session.deleteDocument(...); session.updateDocument(...); // lastly index.endUpdate(); // or.. session.commit()? marks the end of the update sequence, refresh the searchers. IndexReader, IndexWriter, indexSearcher would be managed, and there can be multiple implementations of how index is structured, e.g. RotatingIndex, AlternatingIndex, that rotates document updates to different indices. Ray, On 8/23/05, Otis Gospodnetic <[EMAIL PROTECTED]> wrote: > Yes, this is not how you should do it. > Use reader.delete(Term) method to delete documents: > http://lucene.apache.org/java/docs/api/org/apache/lucene/index/IndexReader.html#delete(org.apache.lucene.index.Term) > > Otis > > --- [EMAIL PROTECTED] wrote: > > > Hi, > > > > i wrote an Index update, where first the IndexReader > > delete all files from index which are changed. > > Than add documents which are not in the index! > > > > Alone the deletion take so long, because i have 2 "for" loops! > > > > file = array with all files in a directory > > > > for (int i = 0; i<file.length; i++) { > > if (file[i].isFile()) { > > for (int j =0; j<reader.numDocs(); j++) { > > if (file[i].getName() == reader.document(j).get("name") && > > file[i].lastModified() > > > Integer.parseInt(reader.document(j).get("date"))) > > { reader.delete(j); > > } > > } > > > > Maybe this is the wrong way? > > > > Bye Derya > > > > > > -- > > 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] > > > > > > > --------------------------------------------------------------------- > 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]