public class BufferingSolrServer extends SolrClient
SolrClient
instance and adds a simple buffer on top of it.
The buffer can hold a series of BufferedRequest
s up to a maximum of maxBufferSize.
Once exceeded, the buffer is flushed. Currently, the buffer will handle requests to add a document
or delete a document either by ID or query.
The life cycle of wrapped SolrClient instance should be managed elsewhere.
You should properly shutdown this instance with a shutdown method.Modifier and Type | Class and Description |
---|---|
static class |
BufferingSolrServer.Action |
Constructor and Description |
---|
BufferingSolrServer(SolrClient delegate,
int maxBufferSize,
long maxFlushIntervalMillis) |
BufferingSolrServer(SolrClient delegate,
int maxBufferSize,
long maxFlushIntervalMillis,
int concurrency,
String searchClusterName,
String collectionId,
MetricRegistry metricRegistry,
String defaultSolrCollection) |
add, add, add, add, add, addBean, addBean, addBean, addBean, addBeans, addBeans, addBeans, addBeans, addBeans, addBeans, commit, commit, commit, commit, commit, commit, getBinder, getById, getById, getById, getById, getById, getById, getById, getById, optimize, optimize, optimize, optimize, optimize, optimize, ping, ping, query, query, query, query, queryAndStreamResponse, queryAndStreamResponse, queryAndStreamResponse, request, rollback, rollback
public BufferingSolrServer(SolrClient delegate, int maxBufferSize, long maxFlushIntervalMillis)
public BufferingSolrServer(SolrClient delegate, int maxBufferSize, long maxFlushIntervalMillis, int concurrency, String searchClusterName, String collectionId, MetricRegistry metricRegistry, String defaultSolrCollection)
delegate
- maxBufferSize
- maxFlushIntervalMillis
- concurrency
- searchClusterName
- for diagnostic purposes onlycollectionId
- for diagnostic purposes onlymetricRegistry
- public void syncFlush()
public int flush()
public void close() throws IOException
IOException
public org.apache.solr.client.solrj.response.UpdateResponse add(SolrInputDocument doc, int commitWithinMs)
add
in class SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse add(Collection<SolrInputDocument> docs)
add
in class SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse add(Collection<SolrInputDocument> docs, int commitWithinMs)
add
in class SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse add(String solrCollection, Collection<SolrInputDocument> docs, int commitWithinMs)
add
in class SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse add(String collection, SolrInputDocument doc, int commitWithinMs)
add
in class SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String collection, String id)
deleteById
in class SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String id)
deleteById
in class SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String collection, String id, int commitWithinMs)
deleteById
in class SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String id, int commitWithinMs)
deleteById
in class SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String collection, List<String> ids)
deleteById
in class SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(List<String> ids)
deleteById
in class SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String collection, List<String> ids, int commitWithinMs)
deleteById
in class SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(List<String> ids, int commitWithinMs)
deleteById
in class SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteByQuery(String collection, String query)
deleteByQuery
in class SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteByQuery(String query)
deleteByQuery
in class SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteByQuery(String collection, String query, int commitWithinMs)
deleteByQuery
in class SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteByQuery(String query, int commitWithinMs)
deleteByQuery
in class SolrClient
public NamedList<Object> request(SolrRequest request, String collection) throws SolrServerException, IOException
request
in class SolrClient
SolrServerException
IOException
public int getNumberOfRequestsInBuffer()