From java-user-return-38467-apmail-lucene-java-user-archive=lucene.apache.org@lucene.apache.org Wed Feb 11 16:50:39 2009 Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 32232 invoked from network); 11 Feb 2009 16:50:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Feb 2009 16:50:39 -0000 Received: (qmail 47476 invoked by uid 500); 11 Feb 2009 16:50:33 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 47247 invoked by uid 500); 11 Feb 2009 16:50:32 -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 47236 invoked by uid 99); 11 Feb 2009 16:50:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Feb 2009 08:50:32 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.221.20] (HELO mail-qy0-f20.google.com) (209.85.221.20) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Feb 2009 16:50:24 +0000 Received: by qyk13 with SMTP id 13so332617qyk.5 for ; Wed, 11 Feb 2009 08:50:03 -0800 (PST) Received: by 10.224.45.75 with SMTP id d11mr717673qaf.153.1234371002629; Wed, 11 Feb 2009 08:50:02 -0800 (PST) Received: from ?10.17.4.4? (pool-173-48-164-75.bstnma.fios.verizon.net [173.48.164.75]) by mx.google.com with ESMTPS id 6sm1151001qwk.37.2009.02.11.08.50.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 11 Feb 2009 08:50:02 -0800 (PST) Message-Id: <8519135D-4163-4378-AE3E-2B7113B40159@mikemccandless.com> From: Michael McCandless To: java-user@lucene.apache.org In-Reply-To: <7d8fb81e0902110753r41fac2dbu9f2f9d4a91af2dcd@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: deletes when the writer is open and autocommit is set to false Date: Wed, 11 Feb 2009 11:50:00 -0500 References: <7d8fb81e0902102350y4b718590u8b63e33be8606035@mail.gmail.com> <7d8fb81e0902110753r41fac2dbu9f2f9d4a91af2dcd@mail.gmail.com> X-Mailer: Apple Mail (2.930.3) X-Virus-Checked: Checked by ClamAV on apache.org Vinubalaji Gopal wrote: > On Wed, Feb 11, 2009 at 2:56 AM, Michael McCandless > wrote: >> IndexWriter can in fact delete documents, by Term or by Query. It >> also has >> updateDocument, which under-the-hood simply calls deleteDocuments >> then >> addDocument. > > Awesome that FAQ entry confused me and I didn't look at IndexWriter > javadoc thinking that it wouldn't be there since deleteDocument is > there in IndexReader. Hmm -- OK I just fixed that FAQ entry. Thanks for raising this! > What is the best way to update a document? Search and do an update if > the document is found/else insert or just try an update whatever be > the case - the update will delete in case a document exists or will > just insert a new document if the document doesn't exist in the index. If you know the doc doesn't exist already, you gain some performance by using add instead of update. But if performance is already fast enough, it may be simpler to just always use update. Or, if you will have to do your own search to find out whether doc exists or not, then always use update since that's what update's doing too. Mike --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org