Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 12277 invoked from network); 28 Mar 2005 15:34:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Mar 2005 15:34:47 -0000 Received: (qmail 97256 invoked by uid 500); 28 Mar 2005 15:34:40 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 97216 invoked by uid 500); 28 Mar 2005 15:34:40 -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 97203 invoked by uid 99); 28 Mar 2005 15:34:40 -0000 X-ASF-Spam-Status: No, hits=2.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,FORGED_YAHOO_RCVD X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from web31103.mail.mud.yahoo.com (HELO web31103.mail.mud.yahoo.com) (68.142.200.36) by apache.org (qpsmtpd/0.28) with SMTP; Mon, 28 Mar 2005 07:34:38 -0800 Received: (qmail 30115 invoked by uid 60001); 28 Mar 2005 15:34:35 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=DBK0BdEXVgUrlyvP3DKTmirxAmUCOlUNN1t6H3M07+M8ENuBb32hV7LOfaTrKPxdZCUeyq3aA3mOK1iOPidqSMSeFv0AjWvqj1Xqn1KF4YX8JKOTot/YXFPksJwxQTDX332QvZl/eFLB94qBBjGNaZz9bKbpoaOA7EvpER/O9O0= ; Message-ID: <20050328153435.30113.qmail@web31103.mail.mud.yahoo.com> Received: from [216.194.55.187] by web31103.mail.mud.yahoo.com via HTTP; Mon, 28 Mar 2005 07:34:35 PST Date: Mon, 28 Mar 2005 07:34:35 -0800 (PST) From: Otis Gospodnetic Subject: Re: batch delete To: java-user@lucene.apache.org, Ben In-Reply-To: <5f4a646105032801596cf82b6a@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N iff = if and only if. Not a typo, but it may be redundant. Otis --- Ben wrote: > Thanks, will investigate your method. > > Is there a typo in the javadoc for Term.compareTo(Term other)? > > From javadoc: > > Compares two terms, returning an integer which is less than zero iff > this term belongs after the argument, equal zero iff this term is > equal to the argument, and greater than zero iff this term belongs > after the argument. > > Shouldn't it be: > > Compares two terms, returning an integer which is less than zero if > this term belongs before the argument, equal zero if this term is > equal to the argument, and greater than zero if this term belongs > after the argument > > Thanks, > Ben > > On Mon, 28 Mar 2005 02:34:07 -0600, Chris Lamprecht > wrote: > > That's one way to do it - do a query, get a list of document IDs, > and > > then delete that list of doc IDs. > > > > The method I mentioned in my previous message is different - you're > > getting a list of all Terms that are in the index. There will be 1 > > term for each date (possibly down to the millisecond), which could > > point to 1 or more documents (maybe 0 or more -- I'm not sure). > But > > using this method, you don't need to know the document IDs; you > only > > need to know all of the terms you want to delete. > > > > Try something like this code -- (double-check to make sure it's ok > to > > delete while enumerating over the Terms): > > > > Term first = new Term("foo", "start"); > > Term last = new Term("foo", "end"); > > TermEnum terms = reader.terms(first); > > while (terms.next() && terms.term().compareTo(last) <= 0) { > > reader.delete(terms.term()); > > } > > reader.close(); > > > > On Mon, 28 Mar 2005 18:19:46 +1000, Ben > wrote: > > > OK, so I have to query for a list of old documents (from a given > date) > > > and delete each document individually? > > > > > > Can I use DateFilter.Before() with Term? > > > > > > Thanks, > > > Ben > > > > > > On Mon, 28 Mar 2005 02:13:48 -0600, Chris Lamprecht > > > wrote: > > > > Ben, > > > > > > > > If you know the exact terms you want to delete, you can do it > without querying: > > > > > > > > IndexReader reader = IndexReader.open(indexDir); > > > > Term deleteTerm = new Term("yyyymmdd", yyyymmdd); > > > > reader.delete(deleteTerm); > > > > > > > > If you are using a lucene date field, I think you'll have to > enumerate > > > > through all the dates that you want to delete. You can use > > > > reader.terms(Term) to get an enumeration of terms. > > > > > > > > -chris > > > > > > > > On Mon, 28 Mar 2005 17:58:44 +1000, Ben > wrote: > > > > > BTW is it possible to do what I am trying to achieve without > querying > > > > > the database or the index? > > > > > > > > > > Thanks, > > > > > Ben > > > > > > > > > > On Mon, 28 Mar 2005 10:38:52 +1000, Ben > wrote: > > > > > > Hi > > > > > > > > > > > > I need to delete a number of documents that are older than > a > > > > > > particular time from a Lucene index. What is the best way > to do this? > > > > > > > > > > > > Thanks, > > > > > > Ben > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > 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 > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > 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 > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org