: : > termDocs = reader.termDocs(term); : > while(termDocs.next()){ : > int index = termDocs.doc(); : > if(reader.document(index).get("id").equals(id)){ : > reader.deleteDocument(index); : > } : > } : : Iterating documents and string comparing stored values is not very efficient. : Use a query instead, something like this:
more specificly: there is no reason at all to look at the stored value -- just ensure that the *indexed* value is the "unique id" (which TermDocs will already ensure for you) : BooleanQuery query = new BooleanQuery(); : query.add(new TermQuery(term), Occurs.MUST); : query.add(new TermQuery(new Term("id", id), Occurs.MUST); note: in the orriginal code, "term" was new Term("id", id) so this is unneded ... the goal was to iterate the doc(s) matching a unique(?) id. -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]