public class CloudSolrServer extends SolrServer
LBHttpSolrServer
to issue requests.
This class assumes the id field for your documents is called
'id' - if this is not the case, you must set the right name
with setIdField(String)
.Modifier and Type | Class and Description |
---|---|
static class |
CloudSolrServer.RouteException |
static class |
CloudSolrServer.RouteResponse |
Constructor and Description |
---|
CloudSolrServer(String zkHost) |
CloudSolrServer(String zkHost,
boolean updatesToLeaders) |
CloudSolrServer(String zkHost,
LBHttpSolrServer lbServer) |
CloudSolrServer(String zkHost,
LBHttpSolrServer lbServer,
boolean updatesToLeaders) |
Modifier and Type | Method and Description |
---|---|
CloudSolrServer.RouteResponse |
condenseResponse(NamedList response,
long timeMillis) |
void |
connect()
Connect to the zookeeper ensemble.
|
String |
getDefaultCollection()
Gets the default collection for request
|
String |
getIdField() |
LBHttpSolrServer |
getLbServer() |
int |
getMinAchievedReplicationFactor(String collection,
NamedList resp)
Useful for determining the minimum achieved replication factor across
all shards involved in processing an update request, typically useful
for gauging the replication factor of a batch.
|
ResponseParser |
getParser() |
RequestWriter |
getRequestWriter() |
Map<String,Integer> |
getShardReplicationFactor(String collection,
NamedList resp)
Walks the NamedList response after performing an update request looking for
the replication factor that was achieved in each shard involved in the request.
|
ZkStateReader |
getZkStateReader() |
boolean |
isUpdatesToLeaders() |
NamedList<Object> |
request(SolrRequest request)
SolrServer implementations need to implement how a request is actually processed
|
void |
setDefaultCollection(String collection)
Sets the default collection for request
|
void |
setIdField(String idField) |
void |
setParallelUpdates(boolean parallelUpdates) |
void |
setParser(ResponseParser processor)
Note: This setter method is not thread-safe.
|
void |
setRequestWriter(RequestWriter requestWriter) |
void |
setZkClientTimeout(int zkClientTimeout)
Set the timeout to the zookeeper ensemble in ms
|
void |
setZkConnectTimeout(int zkConnectTimeout)
Set the connect timeout to the zookeeper ensemble in ms
|
void |
shutdown()
Release allocated resources.
|
add, add, add, add, addBean, addBean, addBeans, addBeans, commit, commit, commit, deleteById, deleteById, deleteById, deleteById, deleteByQuery, deleteByQuery, getBinder, optimize, optimize, optimize, ping, query, query, queryAndStreamResponse, rollback
public CloudSolrServer(String zkHost)
zkHost
- The client endpoint of the zookeeper quorum containing the cloud state,
in the form HOST:PORT.public CloudSolrServer(String zkHost, boolean updatesToLeaders) throws MalformedURLException
MalformedURLException
public CloudSolrServer(String zkHost, LBHttpSolrServer lbServer)
zkHost
- The client endpoint of the zookeeper quorum containing the cloud state,
in the form HOST:PORT.lbServer
- LBHttpSolrServer instance for requests.public CloudSolrServer(String zkHost, LBHttpSolrServer lbServer, boolean updatesToLeaders)
zkHost
- The client endpoint of the zookeeper quorum containing the cloud state,
in the form HOST:PORT.lbServer
- LBHttpSolrServer instance for requests.updatesToLeaders
- sends updates only to leaders - defaults to truepublic ResponseParser getParser()
public void setParser(ResponseParser processor)
processor
- Default Response Parser chosen to parse the response if the parser
were not specified as part of the request.SolrRequest.getResponseParser()
public RequestWriter getRequestWriter()
public void setRequestWriter(RequestWriter requestWriter)
public ZkStateReader getZkStateReader()
public void setIdField(String idField)
idField
- the field to route documents on.public String getIdField()
public void setDefaultCollection(String collection)
public String getDefaultCollection()
public void setZkConnectTimeout(int zkConnectTimeout)
public void setZkClientTimeout(int zkClientTimeout)
public void connect()
public void setParallelUpdates(boolean parallelUpdates)
public CloudSolrServer.RouteResponse condenseResponse(NamedList response, long timeMillis)
public NamedList<Object> request(SolrRequest request) throws SolrServerException, IOException
SolrServer
request
in class SolrServer
SolrServerException
IOException
public void shutdown()
SolrServer
shutdown
in class SolrServer
public LBHttpSolrServer getLbServer()
public boolean isUpdatesToLeaders()
public int getMinAchievedReplicationFactor(String collection, NamedList resp)
public Map<String,Integer> getShardReplicationFactor(String collection, NamedList resp)
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.