private void addDocuments(final Collection<SolrInputDocument> documents, final boolean commit) {
        if (docsIndexed > 0) {
            final String collection = index.getCollection();
            solrIndexClientCache.context(index.getSolrConnectionConfig(), solrClient -> {
                try {
                    if (!documents.isEmpty()) {
                        solrClient.add(collection, documents, commitWithinMs);
                    }

                    if (commit) {
                        solrClient.commit(collection);
                    } else if (softCommit) {
                        solrClient.commit(collection, false, false, true);
                    }
                } catch (final RuntimeException | SolrServerException | IOException e) {
                    log(Severity.FATAL_ERROR, e.getMessage(), e);
                    // Terminate processing as this is a fatal error.
                    throw LoggedException.wrap(e);
                }
            });
        }
    }
Sets the locator to use when reporting errors.

@param locator The locator to use.
stroom-search/stroom-search-solr/src/main/java/stroom/search/solr/indexing/SolrIndexingFilter.java