Skip to content


Subversion checkout URL

You can clone with
Download ZIP
branch: master
51 lines (32 sloc) 1.376 kB

Managing your index

Committing changes

We mentioned the use of commit() above. It takes three optional arguments:

  • waitSearcher
  • expungeDeletes
  • softCommit

See for details.


After updating an index with new data, it becomes fragmented and performance suffers. This means that you need to optimize the index. When and how often you do this is something you need to decide on a case by case basis. If you only add data infrequently, you should optimize after every new update; if you trickle in data on a frequent basis, you need to think more about it. See

Either way, to optimize an index, simply call:


A Solr optimize also performs a commit, so if you’re about to optimize() anyway, you can leave off the preceding commit(). It doesn’t particularly hurt to do both though.

optimize() takes two optional arguments:

  • waitSearcher
  • maxSegments

See for details.


If you haven’t yet added/deleted documents since the last commit, you can issue a rollback to revert the index state to that of the last commit.

Jump to Line
Something went wrong with that request. Please try again.