public class ServerShard
extends SolrClient
Modifier and Type | Field and Description |
---|---|
private static UpdateResponse |
_dummyOKResponse |
private static long |
serialVersionUID |
private ShardSelection |
shards |
private boolean |
writeEnabled |
Constructor and Description |
---|
ServerShard(java.util.ArrayList<SolrClient> server,
ShardSelection.Method method,
boolean writeEnabled) |
Modifier and Type | Method and Description |
---|---|
UpdateResponse |
add(java.util.Collection<SolrInputDocument> docs)
Adds a collection of documents
|
UpdateResponse |
add(java.util.Collection<SolrInputDocument> docs,
int commitWithinMs)
Adds a collection of documents, specifying max time before they become committed
|
UpdateResponse |
add(SolrInputDocument doc)
Adds a single document
|
UpdateResponse |
add(SolrInputDocument doc,
int commitWithinMs)
Adds a single document specifying max time before it becomes committed
|
UpdateResponse |
addBean(java.lang.Object obj)
Adds a single bean
|
UpdateResponse |
addBean(java.lang.Object obj,
int commitWithinMs)
Adds a single bean specifying max time before it becomes committed
|
UpdateResponse |
addBeans(java.util.Collection<?> beans)
Adds a collection of beans
|
UpdateResponse |
addBeans(java.util.Collection<?> beans,
int commitWithinMs)
Adds a collection of beans specifying max time before they become committed
|
UpdateResponse |
commit()
Performs an explicit commit, causing pending documents to be committed for indexing
|
UpdateResponse |
commit(boolean waitFlush,
boolean waitSearcher)
Performs an explicit commit, causing pending documents to be committed for indexing
|
UpdateResponse |
commit(boolean waitFlush,
boolean waitSearcher,
boolean softCommit)
Performs an explicit commit, causing pending documents to be committed for indexing
|
UpdateResponse |
deleteById(java.util.List<java.lang.String> ids)
Deletes a list of documents by unique ID
|
UpdateResponse |
deleteById(java.util.List<java.lang.String> ids,
int commitWithinMs)
Deletes a list of documents by unique ID, specifying max time before commit
|
UpdateResponse |
deleteById(java.lang.String id)
Deletes a single document by unique ID
|
UpdateResponse |
deleteById(java.lang.String id,
int commitWithinMs)
Deletes a single document by unique ID, specifying max time before commit
|
UpdateResponse |
deleteByQuery(java.lang.String query)
Deletes documents from the index based on a query
|
UpdateResponse |
deleteByQuery(java.lang.String query,
int commitWithinMs)
Deletes documents from the index based on a query, specifying max time before commit
|
DocumentObjectBinder |
getBinder() |
UpdateResponse |
optimize()
Performs an explicit optimize, causing a merge of all segments to one.
|
UpdateResponse |
optimize(boolean waitFlush,
boolean waitSearcher)
Performs an explicit optimize, causing a merge of all segments to one.
|
UpdateResponse |
optimize(boolean waitFlush,
boolean waitSearcher,
int maxSegments)
Performs an explicit optimize, causing a merge of all segments to one.
|
SolrPingResponse |
ping()
Issues a ping request to check if the server is alive
|
QueryResponse |
query(SolrParams params)
Performs a query to the Solr server
|
QueryResponse |
query(SolrParams params,
METHOD method)
Performs a query to the Solr server
|
QueryResponse |
queryAndStreamResponse(SolrParams params,
StreamingResponseCallback callback)
Query solr, and stream the results.
|
|
request(SolrRequest request,
java.lang.String collection)
SolrServer implementations need to implement how a request is actually processed
|
UpdateResponse |
rollback()
Performs a rollback of all non-committed documents pending.
|
void |
shutdown() |
private static final long serialVersionUID
private static final UpdateResponse _dummyOKResponse
private final ShardSelection shards
private final boolean writeEnabled
public ServerShard(java.util.ArrayList<SolrClient> server, ShardSelection.Method method, boolean writeEnabled)
public UpdateResponse add(java.util.Collection<SolrInputDocument> docs) throws SolrServerException, java.io.IOException
docs
- the collection of documentsjava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse add(java.util.Collection<SolrInputDocument> docs, int commitWithinMs) throws SolrServerException, java.io.IOException
docs
- the collection of documentscommitWithinMs
- max time (in ms) before a commit will happenjava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse addBeans(java.util.Collection<?> beans) throws SolrServerException, java.io.IOException
beans
- the collection of beansjava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse addBeans(java.util.Collection<?> beans, int commitWithinMs) throws SolrServerException, java.io.IOException
beans
- the collection of beanscommitWithinMs
- max time (in ms) before a commit will happenjava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse add(SolrInputDocument doc) throws SolrServerException, java.io.IOException
doc
- the input documentjava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse add(SolrInputDocument doc, int commitWithinMs) throws SolrServerException, java.io.IOException
doc
- the input documentcommitWithinMs
- max time (in ms) before a commit will happenjava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse addBean(java.lang.Object obj) throws java.io.IOException, SolrServerException
obj
- the input beanjava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse addBean(java.lang.Object obj, int commitWithinMs) throws java.io.IOException, SolrServerException
obj
- the input beancommitWithinMs
- max time (in ms) before a commit will happenjava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse commit() throws SolrServerException, java.io.IOException
waitFlush=true and waitSearcher=true to be inline with the defaults for plain HTTP access
java.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse optimize() throws SolrServerException, java.io.IOException
waitFlush=true and waitSearcher=true to be inline with the defaults for plain HTTP access
Note: In most cases it is not required to do explicit optimize
java.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse commit(boolean waitFlush, boolean waitSearcher) throws SolrServerException, java.io.IOException
waitFlush
- block until index changes are flushed to diskwaitSearcher
- block until a new searcher is opened and registered as the main query searcher, making the changes visiblejava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse commit(boolean waitFlush, boolean waitSearcher, boolean softCommit) throws SolrServerException, java.io.IOException
waitFlush
- block until index changes are flushed to diskwaitSearcher
- block until a new searcher is opened and registered as the main query searcher, making the changes visiblesoftCommit
- makes index changes visible while neither fsync-ing index files nor writing a new index descriptorjava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse optimize(boolean waitFlush, boolean waitSearcher) throws SolrServerException, java.io.IOException
Note: In most cases it is not required to do explicit optimize
waitFlush
- block until index changes are flushed to diskwaitSearcher
- block until a new searcher is opened and registered as the main query searcher, making the changes visiblejava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse optimize(boolean waitFlush, boolean waitSearcher, int maxSegments) throws SolrServerException, java.io.IOException
Note: In most cases it is not required to do explicit optimize
waitFlush
- block until index changes are flushed to diskwaitSearcher
- block until a new searcher is opened and registered as the main query searcher, making the changes visiblemaxSegments
- optimizes down to at most this number of segmentsjava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse rollback() throws SolrServerException, java.io.IOException
Note that this is not a true rollback as in databases. Content you have previously added may have been committed due to autoCommit, buffer full, other client performing a commit etc.
java.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse deleteById(java.lang.String id) throws SolrServerException, java.io.IOException
id
- the ID of the document to deletejava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse deleteById(java.lang.String id, int commitWithinMs) throws SolrServerException, java.io.IOException
id
- the ID of the document to deletecommitWithinMs
- max time (in ms) before a commit will happenjava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse deleteById(java.util.List<java.lang.String> ids) throws SolrServerException, java.io.IOException
ids
- the list of document IDs to deletejava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse deleteById(java.util.List<java.lang.String> ids, int commitWithinMs) throws SolrServerException, java.io.IOException
ids
- the list of document IDs to deletecommitWithinMs
- max time (in ms) before a commit will happenjava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse deleteByQuery(java.lang.String query) throws SolrServerException, java.io.IOException
query
- the query expressing what documents to deletejava.io.IOException
- If there is a low-level I/O error.SolrServerException
public UpdateResponse deleteByQuery(java.lang.String query, int commitWithinMs) throws SolrServerException, java.io.IOException
query
- the query expressing what documents to deletecommitWithinMs
- max time (in ms) before a commit will happenjava.io.IOException
- If there is a low-level I/O error.SolrServerException
public SolrPingResponse ping() throws SolrServerException, java.io.IOException
java.io.IOException
- If there is a low-level I/O error.SolrServerException
public QueryResponse query(SolrParams params) throws SolrServerException, java.io.IOException
params
- an object holding all key/value parameters to send along the requestjava.io.IOException
SolrServerException
public QueryResponse query(SolrParams params, METHOD method) throws SolrServerException, java.io.IOException
params
- an object holding all key/value parameters to send along the requestmethod
- specifies the HTTP method to use for the request, such as GET or POSTjava.io.IOException
SolrServerException
public QueryResponse queryAndStreamResponse(SolrParams params, StreamingResponseCallback callback) throws SolrServerException, java.io.IOException
SolrServerException
java.io.IOException
publicrequest(SolrRequest request, java.lang.String collection) throws SolrServerException, java.io.IOException
SolrServerException
java.io.IOException
public DocumentObjectBinder getBinder()
public void shutdown()