lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: batch delete
Date Mon, 28 Mar 2005 15:34:35 GMT
iff = if and only if.  Not a typo, but it may be redundant.

Otis

--- Ben <newreaders@gmail.com> 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
> <clamprecht@gmail.com> 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 <newreaders@gmail.com>
> 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
> > > <clamprecht@gmail.com> 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 <newreaders@gmail.com>
> 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
> <newreaders@gmail.com> 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


Mime
View raw message