Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2D682DB9D for ; Wed, 31 Oct 2012 16:11:44 +0000 (UTC) Received: (qmail 32951 invoked by uid 500); 31 Oct 2012 16:11:42 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 32905 invoked by uid 500); 31 Oct 2012 16:11:41 -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 32879 invoked by uid 99); 31 Oct 2012 16:11:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Oct 2012 16:11:41 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.160.48] (HELO mail-pb0-f48.google.com) (209.85.160.48) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Oct 2012 16:11:36 +0000 Received: by mail-pb0-f48.google.com with SMTP id wy7so1130815pbc.35 for ; Wed, 31 Oct 2012 09:11:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:x-gm-message-state; bh=utzyb1IT10Skv85UoFeI5aetcl/CVtDDxG53WSyK3Qo=; b=dKgtyWcm5LcFu44N81b1gCydOo0xsGceC7eaqkLdAKbUZJGfEzNFOskn6oOmqyIS7I llnONmDcJNW6yf0sD0oOSBGAQcAsNe50+SaLCvAOc6etza4zJUbEfzK2K3Mrg3NGFYpH OwPIJMPIIUW6XeX9uYO4uKTEuHynPEdrjuJH16knwCcjPu2bwyYAxd8FFwPbc5dR31B9 bQctQAnACKGUb1LDBMCK52giWJ15hHW+oCC+ki8RtmW9qigvu0UqZVhJcINHFB7vIvOx XS+x+Bz5rtp91hToX5YVt4d1NMm+H3pO/I/F0HQnlzeMM6hpLMW08tFjQIXUv4whuumU JKXQ== Received: by 10.68.218.132 with SMTP id pg4mr114883756pbc.100.1351699875702; Wed, 31 Oct 2012 09:11:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.152.67 with HTTP; Wed, 31 Oct 2012 09:10:55 -0700 (PDT) In-Reply-To: <50914695.6020602@sirma.bg> References: <50914695.6020602@sirma.bg> From: Michael McCandless Date: Wed, 31 Oct 2012 12:10:55 -0400 Message-ID: Subject: Re: writer.tryDeleteDocument(..) does not delete document To: java-user@lucene.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQk8FDVd4tYTQScd/5NfWUKbUkHTklPJ0+2Tt3r5sgQaOpNhTVHEWR/+txs0gXX/PDSfKGfc X-Virus-Checked: Checked by ClamAV on apache.org This looks like a real bug! Thanks for reporting it Ivan ... I'll open an issue. Mike McCandless http://blog.mikemccandless.com On Wed, Oct 31, 2012 at 11:41 AM, Ivan Vasilev wrote: > Hy Guys, > > I use as suggested in question "Lucene 4.0 delete by ID" from 29.Oct - > instead of reader.delete(docID) use - writer.tryDeleteDocument(..) method > but for some reason it does not work. > > My code is: > > ........ > > > IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_40, new > StandardAnalyzer(Version.LUCENE_40)); > iwc.setOpenMode(OpenMode.APPEND); > IndexWriter writer = new IndexWriter(indexDir, iwc); > IndexReader nrtReader = DirectoryReader.open(writer, false); // > using "true" gives the same result > writer.tryDeleteDocument(nrtReader, 1); // using > nrtReader.leaves().get(0).reader() gives the same result (I have only one > segment) > nrtReader.close(); > writer.close(); > > IndexReader ir = DirectoryReader.open(indexDir); > System.out.println("ir.numDeletedDocs(): " + ir.numDeletedDocs()); > Bits liveDocs = MultiFields.getLiveDocs(ir); > System.out.println("liveDocs: " + liveDocs); > > ir.close(); > indexDir.close(); > ......................... > > The output is: > > ir.numDeletedDocs(): 0 > liveDocs: null > > -------------------------- > > This is just simple test - no merges or adding new docs after creation of > the index. > > I need deleting by Lucene ID because we have Parallel Indexes and when > deleting document I should delete the related documents from both indexes. > So when having to delete some document I will have Term(s) that are only in > one of the indexes of the parallel index and can use > writer.deleteDocuments(term), but this will not help for the other index in > same Parallel Index. So I will have to find docs matching the Term(s) and > delete them in all sub-indexes of the Parallel Index. > > Cheers, > Ivan > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org