You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by ilkay polat <po...@gmail.com> on 2010/05/20 09:57:20 UTC

Removing old datas from index file

Hello;

I need to learn whether there is a way to remove some records on indexed
files. And is it rapid for removing some indexed file records (For example
clean old records whose created date's are less than a definite day) .
Thanks

Re: Removing old datas from index file

Posted by Ian Lea <ia...@gmail.com>.
> I need to learn whether there is a way to remove some records on indexed
> files.

Of course.  See IndexReader and IndexWriter deleteXXX methods.

> And is it rapid for removing some indexed file records

Of course.

> (For example clean old records whose created date's are less than a definite day) .

If the created date is an indexed field you could do this with one of
the methods that takes a query - RangeQuery in your case from, say, 0
TO 20100101, dependent obviously on your data.  It the date field is
not indexed you could loop through all docs checking the date and
zapping the old ones by docNum



--
Ian.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org