I noticed a strange behaviour when using SolrJ 8.5.1 with Solr Server 8.8.2 without being able to figure out if it was an expected issue or not. Basically I performed the following with SolrJ API:
String docId = "someKey";
SolrInputDocument inputDocument = createDocument(docId);
SolrClient solrClient = getClient();
solrClient.add(inputDocument);
// false means hardCommit according to the API
// also tried with commit() which should behave the same.
solrClient.commit(true, true, false);
System.out.println(solrClient.getById(docId));
solrClient.deleteById(docId);
// false means hardCommit according to the API
// also tried with commit() which should behave the same.
solrClient.commit(true, true, false);
// this should output null
// but it does output the doc
System.out.println(solrClient.getById(docId));
This script outputs:
[id:someKey, reference:fooId44, scale:1, managerId:like, vote:1, version:1717398236211183616]
[id:someKey, reference:fooId44, scale:1, managerId:like, vote:1, version:1717398236211183616]
So as you can see it seems that the commit() call behaves like a soft commit instead of a hard commit.
I'm not reproducing this systematically (probably because the soft commit might be fast enough in some cases), but I do reproduce it on a specific server, without being able to find what could be the cause. So I'm wondering if it's a known behaviour when using an old SolrJ API?
I haven't found any related notes in the upgrade notes on Solr.