Lucene has an API for very fast deletion of the index (ie, it removes
the files): IndexWriter.deleteAll().  It's part of the transaction,
ie, you still must call .commit() to make the change visible to
external readers.

But I don't know whether this is exposed in Solr...

Mike

On Thu, Sep 23, 2010 at 8:50 AM, Jonathan Rochkind <rochk...@jhu.edu> wrote:
> Because even after you've deleted every document from the index, there are 
> still actually index _files_ on disk taking up space.  Lucene organizes it's 
> files for quick access, and a consequence of this is that deleting a document 
> does not neccesarily reclaim the disk space.   Optimize will reclaim that 
> disk space.
>
> For deleting ALL documents in your index there's actually a shortcut though. 
> Delete the entire solr 'data' directory and restart Solr, Solr will recreate 
> the data directory with starter index files.  (Note you have to delete the 
> directory itself, if you just delete all the files inside it, Solr will get 
> unhappy).   I am somewhat suspicious of doing this and would never do it on a 
> production index, but for just development playing around where it's not that 
> disastrous if something goes wrong, it's a lot lot quicker than an actual 
> delete command followed by an optimize.
> ________________________________________
> From: kenf_nc [ken.fos...@realestate.com]
> Sent: Thursday, September 23, 2010 8:22 AM
> To: solr-user@lucene.apache.org
> Subject: Re: How can I delete the entire contents of the index?
>
> Quick tangent... I went to the link you provided, and the delete part makes
> sense. But the next tip, how to re-index after a schema change. What is the
> point of step
>
>    5. Send an <optimize/> command.
>
> ? Why do you need to optimize an empty index? Or is my understanding of
> Optimize incorrect?
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/How-can-I-delete-the-entire-contents-of-the-index-tp1565548p1567640.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Reply via email to