Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 88075 invoked from network); 3 Dec 2004 16:05:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 3 Dec 2004 16:05:21 -0000 Received: (qmail 20940 invoked by uid 500); 3 Dec 2004 16:04:35 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 20849 invoked by uid 500); 3 Dec 2004 16:04:33 -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 20779 invoked by uid 99); 3 Dec 2004 16:04:32 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from Unknown (HELO zebedee.magus.co.uk) (193.131.98.10) by apache.org (qpsmtpd/0.28) with ESMTP; Fri, 03 Dec 2004 08:04:30 -0800 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: hits.length() changes during delete process. X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Date: Fri, 3 Dec 2004 16:05:10 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: hits.length() changes during delete process. Thread-Index: AcTZUee9aqk2+9fwR1G6GOq0yee7SQ== From: "David Townsend" To: "Lucene Users List \(E-mail\)" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N I have a delete script IndexSearcher searcher =3D new IndexSearcher(reader); Hits hits =3D searcher.search(query); log.info("there are " + hits.length() + " hits"); for (int i =3D 0; i < hits.length(); i++) { log.info(hits.length() + " " + i + " " + hits.id(i)); reader.delete(hits.id(i)); } which iterates through the results of a search and deletes the returns. = I keep getting an ArrayIndexOutOfBoundsException. I've found the reason = is that hits.length() actually changes during the iteration in large = regular steps i.e=20 The hits length is initially 10003 after 100 deletions hits.length() changes to 9903 after 200 deletions hits.length() changes to 9803 then changes after=20 200 deletions 400 800 1600 3200 So the short question is, should the hits object be changing and what is = the best way to delete all the results of a search (it's a range query = so I can't use delete(Term term)?=20 cheers. David --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org