Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 129 invoked from network); 1 Feb 2005 20:27:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 1 Feb 2005 20:27:38 -0000 Received: (qmail 67509 invoked by uid 500); 1 Feb 2005 20:27:29 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 67474 invoked by uid 500); 1 Feb 2005 20:27:29 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 67460 invoked by uid 99); 1 Feb 2005 20:27:29 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from 209-254-108-74.ip.mcleodusa.net (HELO enigmastation.com) (209.254.108.74) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 01 Feb 2005 12:27:28 -0800 Received: from localhost (joeo@localhost) by enigmastation.com (8.11.6/8.11.6) with ESMTP id j11KNRk31433 for ; Tue, 1 Feb 2005 15:23:27 -0500 Date: Tue, 1 Feb 2005 15:23:27 -0500 (EST) From: Joseph Ottinger To: Lucene Users List Subject: Re: How do I delete? In-Reply-To: <41FFE58E.2080507@sgi.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N I've had success with deletion by running IndexReader.delete(int), then getting an IndexWriter and optimizing the directory. I don't know if that's "the right way" to do it or not. On Tue, 1 Feb 2005, Jim Lynch wrote: > I've been merrily cooking along, thinking I was replacing documents when > I haven't. My logic is to go through a batch of documents, get a field > called "reference" which is unique build a term from it and delete it > via the reader.delete() method. Then I close the reader and open a > writer and reprocess the batch indexing all. > > Here is the delete and associated code: > > reader = IndexReader.open(database); > > Term t = new Term("reference",reference); > try { > reader.delete(t); > } catch (Exception e) { > System.out.println("Delete exception;"+e); > } > > except it isn't working. I tried to do a commt and a doCommit, but > those are both protected. I do a reader.close() after processing the > batch the first time. > > What am I missing? I don't get an exception. Reference is definitely a > valid field, 'cause I print out the value at search time and compare to > the doc and they are identical. > > Thanks, > Jim. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: lucene-user-help@jakarta.apache.org > ----------------------------------------------------------------------- Joseph B. Ottinger http://enigmastation.com IT Consultant joeo@enigmastation.com --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org