lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Batch deletions of Records from index
Date Fri, 25 Nov 2005 08:26:43 GMT

: Need is to device a solution that will delete all the old records (
: three months). I tried keeping the record of Docid's added but that is
: not really helping cause number of record added can vary. one solution
: can be indexing the date of index also but i can not alter the index
: now.

well, in order to delete "old" records, you're going to need some way to
quantify "old" at the moment you want to do the deletes.  If you had a
date in the index, that would be helpful -- but as long as you've got
*some* indexed field restriction you can use to specify the docs, you can
get the docIds to delete.

if you look at the way IndexReader.delete(Term) is implimented, you can
see how easy it is to do if you have a unique Term you wanted to use.  if
you had a date range (or any lexical string range) you can do something
almost as simple using a TermEnum/TermDoc combo (take a look at the way
RangeFilter works for example)

Actually... it never really occured to me, but if you take the IndexReader
you're using for doing the delete and used it to construct an
IndexSearcher, you should be able to write a HitCollector that deletes the
docs based on any Query you write.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message