Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 40100 invoked from network); 20 Jun 2009 11:04:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 20 Jun 2009 11:04:20 -0000 Received: (qmail 31216 invoked by uid 500); 20 Jun 2009 11:04:30 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 31128 invoked by uid 500); 20 Jun 2009 11:04:30 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 31120 invoked by uid 99); 20 Jun 2009 11:04:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Jun 2009 11:04:30 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Jun 2009 11:04:28 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 57180234C004 for ; Sat, 20 Jun 2009 04:04:07 -0700 (PDT) Message-ID: <1676200797.1245495847342.JavaMail.jira@brutus> Date: Sat, 20 Jun 2009 04:04:07 -0700 (PDT) From: "Michael McCandless (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Commented: (LUCENE-1705) Add deleteAllDocuments() method to IndexWriter In-Reply-To: <80346501.1245442687486.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-1705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12722172#action_12722172 ] Michael McCandless commented on LUCENE-1705: -------------------------------------------- This should be simple to implement, by taking the logic that's now in IndexWriter's init method (under the {{if (create) {}}) and pulling out into a separate method. >From IndexWriter's standpoint, this is just another commit, on equal footing with all prior commits even though it up and deleted all segments. So eg a deletion policy could choose to keep those past commits around, IndexReaders can open those past commits, etc. One good functional gain by offering this method is it could be done within a single IndexWriter transaction. Ie you could deleteAll, make further changes, etc., but then change your mind and rollback the entire transaction. Whereas, requiring if you close & re-open the writer with create=true, you've necessarily committed the change to the index. So I don't think we should implicitly do a commit() from within deleteAll(); I think the user should call commit() on their own. > Add deleteAllDocuments() method to IndexWriter > ---------------------------------------------- > > Key: LUCENE-1705 > URL: https://issues.apache.org/jira/browse/LUCENE-1705 > Project: Lucene - Java > Issue Type: Wish > Components: Index > Affects Versions: 2.4 > Reporter: Tim Smith > > Ideally, there would be a deleteAllDocuments() or clear() method on the IndexWriter > This method should have the same performance and characteristics as: > * currentWriter.close() > * currentWriter = new IndexWriter(..., create=true,...) > This would greatly optimize a delete all documents case. Using deleteDocuments(new MatchAllDocsQuery()) could be expensive given a large existing index. > IndexWriter.deleteAllDocuments() should have the same semantics as a commit(), as far as index visibility goes (new IndexReader opening would get the empty index) > I see this was previously asked for in LUCENE-932, however it would be nice to finally see this added such that the IndexWriter would not need to be closed to perform the "clear" as this seems to be the general recommendation for working with an IndexWriter now > deleteAllDocuments() method should: > * abort any background merges (they are pointless once a deleteAll has been received) > * write new segments file referencing no segments > This method would remove one of the final reasons i would ever need to close an IndexWriter and reopen a new one -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org