iff = if and only if. Not a typo, but it may be redundant. Otis
--- Ben <[EMAIL PROTECTED]> 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 > <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> > 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 > > > <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> > 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 > <[EMAIL PROTECTED]> 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: > [EMAIL PROTECTED] > > > > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]