public class BufferingSolrServer
extends org.apache.solr.client.solrj.SolrClient
SolrClient
instance and adds a simple buffer on top of it.
The buffer can hold a series of BufferingSolrServer.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(org.apache.solr.client.solrj.SolrClient delegate,
int maxBufferSize,
long maxFlushIntervalMillis) |
BufferingSolrServer(org.apache.solr.client.solrj.SolrClient delegate,
int maxBufferSize,
long maxFlushIntervalMillis,
int concurrency,
String searchClusterName,
String collectionId,
com.codahale.metrics.MetricRegistry metricRegistry,
String defaultSolrCollection) |
Modifier and Type | Method and Description |
---|---|
org.apache.solr.client.solrj.response.UpdateResponse |
add(Collection<org.apache.solr.common.SolrInputDocument> docs) |
org.apache.solr.client.solrj.response.UpdateResponse |
add(Collection<org.apache.solr.common.SolrInputDocument> docs,
int commitWithinMs) |
org.apache.solr.client.solrj.response.UpdateResponse |
add(org.apache.solr.common.SolrInputDocument doc,
int commitWithinMs) |
org.apache.solr.client.solrj.response.UpdateResponse |
add(String solrCollection,
Collection<org.apache.solr.common.SolrInputDocument> docs,
int commitWithinMs) |
org.apache.solr.client.solrj.response.UpdateResponse |
add(String collection,
org.apache.solr.common.SolrInputDocument doc,
int commitWithinMs) |
void |
close() |
org.apache.solr.client.solrj.response.UpdateResponse |
deleteById(List<String> ids) |
org.apache.solr.client.solrj.response.UpdateResponse |
deleteById(List<String> ids,
int commitWithinMs) |
org.apache.solr.client.solrj.response.UpdateResponse |
deleteById(String id) |
org.apache.solr.client.solrj.response.UpdateResponse |
deleteById(String id,
int commitWithinMs) |
org.apache.solr.client.solrj.response.UpdateResponse |
deleteById(String collection,
List<String> ids) |
org.apache.solr.client.solrj.response.UpdateResponse |
deleteById(String collection,
List<String> ids,
int commitWithinMs) |
org.apache.solr.client.solrj.response.UpdateResponse |
deleteById(String collection,
String id) |
org.apache.solr.client.solrj.response.UpdateResponse |
deleteById(String collection,
String id,
int commitWithinMs) |
org.apache.solr.client.solrj.response.UpdateResponse |
deleteByQuery(String query) |
org.apache.solr.client.solrj.response.UpdateResponse |
deleteByQuery(String query,
int commitWithinMs) |
org.apache.solr.client.solrj.response.UpdateResponse |
deleteByQuery(String collection,
String query) |
org.apache.solr.client.solrj.response.UpdateResponse |
deleteByQuery(String collection,
String query,
int commitWithinMs) |
int |
flush() |
int |
getNumberOfRequestsInBuffer() |
org.apache.solr.common.util.NamedList<Object> |
request(org.apache.solr.client.solrj.SolrRequest request,
String collection) |
void |
syncFlush() |
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(org.apache.solr.client.solrj.SolrClient delegate, int maxBufferSize, long maxFlushIntervalMillis)
public BufferingSolrServer(org.apache.solr.client.solrj.SolrClient delegate, int maxBufferSize, long maxFlushIntervalMillis, int concurrency, String searchClusterName, String collectionId, com.codahale.metrics.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(org.apache.solr.common.SolrInputDocument doc, int commitWithinMs)
add
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse add(Collection<org.apache.solr.common.SolrInputDocument> docs)
add
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse add(Collection<org.apache.solr.common.SolrInputDocument> docs, int commitWithinMs)
add
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse add(String solrCollection, Collection<org.apache.solr.common.SolrInputDocument> docs, int commitWithinMs)
add
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse add(String collection, org.apache.solr.common.SolrInputDocument doc, int commitWithinMs)
add
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String collection, String id)
deleteById
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String id)
deleteById
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String collection, String id, int commitWithinMs)
deleteById
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String id, int commitWithinMs)
deleteById
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String collection, List<String> ids)
deleteById
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(List<String> ids)
deleteById
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String collection, List<String> ids, int commitWithinMs)
deleteById
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(List<String> ids, int commitWithinMs)
deleteById
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteByQuery(String collection, String query)
deleteByQuery
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteByQuery(String query)
deleteByQuery
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteByQuery(String collection, String query, int commitWithinMs)
deleteByQuery
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.client.solrj.response.UpdateResponse deleteByQuery(String query, int commitWithinMs)
deleteByQuery
in class org.apache.solr.client.solrj.SolrClient
public org.apache.solr.common.util.NamedList<Object> request(org.apache.solr.client.solrj.SolrRequest request, String collection) throws org.apache.solr.client.solrj.SolrServerException, IOException
request
in class org.apache.solr.client.solrj.SolrClient
org.apache.solr.client.solrj.SolrServerException
IOException
public int getNumberOfRequestsInBuffer()