Fix NPE when using SolrIndexThread instead of LocalIndexThread
Calling commit() from a client is bad practice (see https://lucidworks.com/2013/08/23/understanding-transaction-logs-softcommit-and-commit-in-sorlcloud/), although this is at the end and doesn't effect indexing performance. Properly close the SolrClient instead.
@@ -458,7 +458,7 @@ public final class IndexCollection {
@Override
public void destroyObject(PooledObject<SolrClient> pooled) throws Exception {
- pooled.getObject().commit(args.solrIndex);
+ pooled.getObject().close();
}
}
@@ -530,6 +530,7 @@ public final class IndexCollection {
}
try {
+ if (writer != null)
writer.commit();
if (args.optimize)
writer.forceMerge(1);
@@ -537,6 +538,7 @@ public final class IndexCollection {
solrPool.close();
} finally {
try {
+ if (writer != null)
writer.close();
} catch (IOException e) {
// It is possible that this happens... but nothing much we can do at this point,
