Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 23960 invoked from network); 13 Mar 2007 21:13:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Mar 2007 21:13:44 -0000 Received: (qmail 5780 invoked by uid 500); 13 Mar 2007 21:13:44 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 5737 invoked by uid 500); 13 Mar 2007 21:13:43 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 5726 invoked by uid 99); 13 Mar 2007 21:13:43 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Mar 2007 14:13:43 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [212.226.92.15] (HELO monkey.teamware.com) (212.226.92.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Mar 2007 14:13:32 -0700 Received: from nimitz (nimitz.teamw.com [10.142.128.10]) by monkey.teamware.com (8.13.1/8.13.1) with ESMTP id l2DLD5ar026161 for ; Tue, 13 Mar 2007 23:13:05 +0200 Received: from [10.142.3.11] ([10.142.3.11]) by nimitz with ESMTP id m3dnd3hn; 13 Mar 2007 23:13:00 +0200 Message-ID: <45F713DE.3050704@teamware.com> Date: Wed, 14 Mar 2007 08:13:02 +1100 From: Antony Bowesman Organization: Teamware Group User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: java-user@lucene.apache.org Subject: Re: [Urgent] deleteDocuments fails after merging ... References: <359a92830703130950q3d72a1b3idee9e92bbec18b9a@mail.gmail.com> In-Reply-To: <359a92830703130950q3d72a1b3idee9e92bbec18b9a@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.6 (monkey.teamware.com [212.226.92.15]); Tue, 13 Mar 2007 23:13:05 +0200 (EET) X-TWG-MailScanner-Information: See www.mailscanner.info for information X-TWG-MailScanner: Found to be clean X-TWG-MailScanner-SpamCheck: not spam, SpamAssassin (score=-0.185, required 5, autolearn=not spam, BAYES_40 -0.18) X-MailScanner-From: adb@teamware.com X-Virus-Checked: Checked by ClamAV on apache.org Erick Erickson wrote: > The javadocs point out that this line > > * int* nb = mIndexReaderClone.deleteDocuments(urlTerm) > > removes*all* documents for a given term. So of course you'll fail > to delete any documents the second time you call > deleteDocuments with the same term. Isn't the code snippet below doing a search before attempting the deletion, so from the IndexReader's point of view (as used by the IndexSearcher) the item exists. What is mIndexReaderClone? Is that the same reader that is used in IndexSearcher? I'm not sure, but if you search with one IndexReader and delete the document using another IndexReader and then repeat the process, I think that the search would still result in a hit, but the deletion would return 0. > On 3/13/07, DECAFFMEYER MATHIEU wrote: >> >> Before I delete a document I search it in the index to be sure there is a >> hit (via a Term object), >> When I find a hit I delete the document (with the same Term object), >> Hits hits = search(query); >> *if* (hits.length() > 0) { >> * if* (hits.length() > 1) { >> System.out.println("found in the index with duplicates"); >> } >> System.out.println("found in the index"); >> * try* { >> * int* nb = mIndexReaderClone.deleteDocuments(urlTerm); >> * if* (nb > 0) >> System.out.println("successfully deleted"); >> * else* >> * throw** new* IOException("0 doc deleted"); >> }* catch* (IOException e) { >> e.printStackTrace(); >> * throw** new* Exception( >> Thread.currentThread().getName() + " --- Deleting Antony --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org