On 1/8/2013 3:38 PM, hyrax wrote:
Hi folks,
I'm using Solr 4.0.0 and trying to modify the example to build a search app.
So far it works fine.
However, I couldn't figure out how to clean up old index, say index created
20 days ago.
I noticed the DeletionPolicy and I activated it by modifying solrconfig.xml
by adding:
<deletionPolicy class="solr.SolrDeletionPolicy">
<str name="maxCommitsToKeep">1</str>
<str name="maxOptimizedCommitsToKeep">0</str>
<str name="maxCommitAge">3MINUTES</str>
</deletionPolicy>
I think the above should clean up the index created 3 minutes ago but it
definitely not the case...
What I want to test is that we created some indexes and 3 minutes they would
be deleted by Solr.
Because you have maxCommitsToKeep set to 1 (the default), the deletion
policy will never really do anything out of the ordinary, and there will
only ever be one commit point. What the deletionPolicy does is let
Lucene keep track of multiple commits (previous versions of the index at
each time an index commit is done), and decide how many of the old ones
to keep around. It is not keeping track of multiple indexes.
If you are saying that the index should delete any document older than 3
minutes, I do not think you can get Solr to do this on the server side.
You'll have to set up a client process that connects and deletes
whatever data you wish to delete - if you can construct a query that
identifies documents older than 3 minutes, you can do a deleteByQuery
using that query.
Thanks,
Shawn