Search in sources :

Example 21 with CommitUpdateCommand

use of org.apache.solr.update.CommitUpdateCommand in project SearchServices by Alfresco.

the class SolrInformationServer method commit.

@Override
public void commit() throws IOException {
    // avoid multiple commits and warming searchers
    commitAndRollbackLock.writeLock().lock();
    try {
        canUpdate();
        SolrQueryRequest request = null;
        UpdateRequestProcessor processor = null;
        try {
            request = getLocalSolrQueryRequest();
            processor = this.core.getUpdateProcessingChain(null).createProcessor(request, new SolrQueryResponse());
            processor.processCommit(new CommitUpdateCommand(request, false));
        } finally {
            if (processor != null) {
                processor.finish();
            }
            if (request != null) {
                request.close();
            }
        }
    } finally {
        commitAndRollbackLock.writeLock().unlock();
    }
}
Also used : LocalSolrQueryRequest(org.apache.solr.request.LocalSolrQueryRequest) SolrQueryRequest(org.apache.solr.request.SolrQueryRequest) SolrQueryResponse(org.apache.solr.response.SolrQueryResponse) UpdateRequestProcessor(org.apache.solr.update.processor.UpdateRequestProcessor) CommitUpdateCommand(org.apache.solr.update.CommitUpdateCommand)

Aggregations

CommitUpdateCommand (org.apache.solr.update.CommitUpdateCommand)21 LocalSolrQueryRequest (org.apache.solr.request.LocalSolrQueryRequest)12 SolrQueryRequest (org.apache.solr.request.SolrQueryRequest)12 ModifiableSolrParams (org.apache.solr.common.params.ModifiableSolrParams)8 SolrException (org.apache.solr.common.SolrException)7 SolrQueryResponse (org.apache.solr.response.SolrQueryResponse)6 SolrCore (org.apache.solr.core.SolrCore)5 AddUpdateCommand (org.apache.solr.update.AddUpdateCommand)5 UpdateRequestProcessor (org.apache.solr.update.processor.UpdateRequestProcessor)4 Date (java.util.Date)3 SolrInputDocument (org.apache.solr.common.SolrInputDocument)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ExecutionException (java.util.concurrent.ExecutionException)2 AtomicLong (java.util.concurrent.atomic.AtomicLong)2 QName (org.alfresco.service.namespace.QName)2 SolrServletRequest (org.alfresco.solr.AbstractAlfrescoSolrTests.SolrServletRequest)2 SolrServerException (org.apache.solr.client.solrj.SolrServerException)2