0

On a different SO question I have asked to clarify my understanding about different types of solr commits. This is the thread link Understanding the different type of SOLR commits

Now, Basically I want to know what happens underneath solr when I pass commit=true or commit=false with any solr POST request.

commit=true

curl -X POST -H 'Content-Type: application/json' 'http://localhost:8983/solr/keywords/update/json/docs?commit=true' --data-binary '{ "id": "550148", "keyword": "astle city", "formatted_address": "Auckland, New Zealand", "country_code": "NZ", "region": "Auckland", "place": "Auckland", "lat": "-36.84846", "lng": "174.763332", "update_date": "2015-10-0500: 49: 35", "index": "0", "north": "NULL", "south": "NULL", "east": "NULL", "west": "NULL" }'

commit=false

curl -X POST -H 'Content-Type: application/json' 'http://localhost:8983/solr/keywords/update/json/docs?commit=false' --data-binary '{ "id": "550148", "keyword": "astle city", "formatted_address": "Auckland, New Zealand", "country_code": "NZ", "region": "Auckland", "place": "Auckland", "lat": "-36.84846", "lng": "174.763332", "update_date": "2015-10-0500: 49: 35", "index": "0", "north": "NULL", "south": "NULL", "east": "NULL", "west": "NULL" }'

What is the default value of commit params when I don't set it?

A l w a y s S u n n y
  • 36,497
  • 8
  • 60
  • 103

2 Answers2

1

simply, commit means apply to index data which updated Documents. if commit=false, just record on tlog and can't be searched. but commit=true, Updated Documents can be searched with new searcher. ( especially update with openSearcher=false, It also can't be searched. )

han058
  • 908
  • 8
  • 19
  • if I set commit=true and openSearcher=true that is Hard Commit (I will be able to search the document) and if I set commit=true and openSearcher=false is Soft Commit (I will not be able to search the document)? – A l w a y s S u n n y Jul 25 '17 at 17:33
  • read this article, https://lucidworks.com/2013/08/23/understanding-transaction-logs-softcommit-and-commit-in-sorlcloud/ – han058 Jul 27 '17 at 02:42
1

As mentioned in the previous answer, have a detailed look to this bit[3] .

If you pass the "commit" parameter, you are asking for an Hard commit. If you don't, no commit will happen. Until a Searcher is opened , you can not search the documents you indexed. The way to tell Solr to open a Searcher is with a Soft Commit or with an Hard Commit ( open searcher = true ) .

Until you do a commit, you can not search those docs and potentially you don't even flush them to your Lucene Directory( this depends on your RAMBuffer as well, but it is a different story)

[3] https://cwiki.apache.org/confluence/display/solr/UpdateHandlers+in+SolrConfig#UpdateHandlersinSolrConfig-commitandsoftCommit

  • Thanks for your answer again. I got your point that without the searcher is opened(open searcher=true), I will not be able to search the document that I indexed and to open searcher I need to do Soft Commit or Hard commit. So basically `commit=true` is hard commit and `commit=false` is soft commit. Am I right ? what is the default value of commit param if I don't set anything with my url? – A l w a y s S u n n y Jul 25 '17 at 17:29
  • No. Have you read the documentation ? commit=false is not soft commit. It is no commit at all. softCommit=true is soft commit. – Alessandro Benedetti Jul 26 '17 at 10:10
  • 1