Package org.apache.solr.client.solrj
Class SolrRequest<T extends SolrResponse>
- java.lang.Object
-
- org.apache.solr.client.solrj.SolrRequest<T>
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AbstractSchemaRequest
,AbstractUpdateRequest
,CollectionAdminRequest
,ConfigSetAdminRequest
,CoreAdminRequest
,DelegationTokenRequest
,DirectXmlRequest
,DocumentAnalysisRequest
,FieldAnalysisRequest
,GenericSolrRequest
,HealthCheckRequest
,LukeRequest
,QueryRequest
,SolrPing
,V2Request
public abstract class SolrRequest<T extends SolrResponse> extends Object implements Serializable
- Since:
- solr 1.3
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SolrRequest.METHOD
-
Field Summary
Fields Modifier and Type Field Description static Set<String>
SUPPORTED_METHODS
protected boolean
useBinaryV2
protected boolean
usev2
-
Constructor Summary
Constructors Constructor Description SolrRequest(SolrRequest.METHOD m, String path)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected abstract T
createResponse(SolrClient client)
Create a new SolrResponse to hold the response from the serverString
getBasePath()
String
getBasicAuthPassword()
String
getBasicAuthUser()
String
getCollection()
Collection<ContentStream>
getContentStreams()
Deprecated.Please usegetContentWriter(String)
instead.RequestWriter.ContentWriter
getContentWriter(String expectedType)
If a request object wants to do a push write, implement this method.SolrRequest.METHOD
getMethod()
abstract SolrParams
getParams()
String
getPath()
Set<String>
getQueryParams()
Parameter keys that are sent via the query stringResponseParser
getResponseParser()
StreamingResponseCallback
getStreamingResponseCallback()
Principal
getUserPrincipal()
T
process(SolrClient client)
Send this request to aSolrClient
and return the responseT
process(SolrClient client, String collection)
Send this request to aSolrClient
and return the responsevoid
setBasePath(String path)
SolrRequest
setBasicAuthCredentials(String user, String password)
void
setMethod(SolrRequest.METHOD method)
void
setPath(String path)
void
setQueryParams(Set<String> queryParams)
void
setResponseParser(ResponseParser responseParser)
Optionally specify how the Response should be parsed.void
setStreamingResponseCallback(StreamingResponseCallback callback)
SolrRequest
setUseBinaryV2(boolean flag)
If set to true use javabin instead of json (default)void
setUserPrincipal(Principal userPrincipal)
SolrRequest
setUseV2(boolean flag)
If set to true, every request that implementsV2RequestSupport
will be converted to a V2 API call
-
-
-
Constructor Detail
-
SolrRequest
public SolrRequest(SolrRequest.METHOD m, String path)
-
-
Method Detail
-
setUserPrincipal
public void setUserPrincipal(Principal userPrincipal)
-
getUserPrincipal
public Principal getUserPrincipal()
-
setUseV2
public SolrRequest setUseV2(boolean flag)
If set to true, every request that implementsV2RequestSupport
will be converted to a V2 API call
-
setUseBinaryV2
public SolrRequest setUseBinaryV2(boolean flag)
If set to true use javabin instead of json (default)
-
setBasicAuthCredentials
public SolrRequest setBasicAuthCredentials(String user, String password)
-
getBasicAuthUser
public String getBasicAuthUser()
-
getBasicAuthPassword
public String getBasicAuthPassword()
-
getMethod
public SolrRequest.METHOD getMethod()
-
setMethod
public void setMethod(SolrRequest.METHOD method)
-
getPath
public String getPath()
-
setPath
public void setPath(String path)
-
getResponseParser
public ResponseParser getResponseParser()
- Returns:
- The
ResponseParser
-
setResponseParser
public void setResponseParser(ResponseParser responseParser)
Optionally specify how the Response should be parsed. Not all server implementations require a ResponseParser to be specified.- Parameters:
responseParser
- TheResponseParser
-
getStreamingResponseCallback
public StreamingResponseCallback getStreamingResponseCallback()
-
setStreamingResponseCallback
public void setStreamingResponseCallback(StreamingResponseCallback callback)
-
getQueryParams
public Set<String> getQueryParams()
Parameter keys that are sent via the query string
-
getParams
public abstract SolrParams getParams()
-
getContentStreams
@Deprecated public Collection<ContentStream> getContentStreams() throws IOException
Deprecated.Please usegetContentWriter(String)
instead.- Throws:
IOException
-
getContentWriter
public RequestWriter.ContentWriter getContentWriter(String expectedType)
If a request object wants to do a push write, implement this method.- Parameters:
expectedType
- This is the type that the RequestWriter would like to get. But, it is OK to send any format
-
createResponse
protected abstract T createResponse(SolrClient client)
Create a new SolrResponse to hold the response from the server- Parameters:
client
- theSolrClient
the request will be sent to
-
process
public final T process(SolrClient client, String collection) throws SolrServerException, IOException
Send this request to aSolrClient
and return the response- Parameters:
client
- the SolrClient to communicate withcollection
- the collection to execute the request against- Returns:
- the response
- Throws:
SolrServerException
- if there is an error on the Solr serverIOException
- if there is a communication error
-
process
public final T process(SolrClient client) throws SolrServerException, IOException
Send this request to aSolrClient
and return the response- Parameters:
client
- the SolrClient to communicate with- Returns:
- the response
- Throws:
SolrServerException
- if there is an error on the Solr serverIOException
- if there is a communication error
-
getCollection
public String getCollection()
-
setBasePath
public void setBasePath(String path)
-
getBasePath
public String getBasePath()
-
-