Search code examples
solrlucenesolrnet

Difference between Solr Add and Solr Commit


What is the fundamental difference between Add & Commit in Solr? We have read several document, but still now very much clear what it exactly do, and when use Add & when to use Commit ?

As far as I understand, Add adds data into the solr database, and commit updates its index to include new data? But, still not very much clear hence, posting it here to understand it very clearly.


Solution

  • Add will add the document to the Index.
    However, the document will not returned as search result unless you commit.
    When you are indexing documents to solr none of the changes (add/delete/update) you make will appear until you run the commit command.

    A commit operation makes index changes visible to new search requests.
    

    As Commit is an heavy operation (involves opening of Searchers and Auto Warming of caches), you can add documents but should commit in batches.