I'm not sure if you wold see non-zero code in solrj in general, since in org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpRequestBase, ResponseParser):491 for each non-ok Status Code SolrException will be thrown ( sorlj 5.3.0).
Possible values ββ(according to this , Solr 1.x) set in org.apache.solr.core.SolrCore , in the postDecorateResponse method (Solr 5.2.1, before that it was used as the setResponseHeaderValues method), it will use either 500 for general exceptions , or code of SolrException (see Enum SolrException.ErrorCode ):
400 - BAD_REQUEST 401 - UNAUTHORIZED 403 - FORBIDDEN 404 - NOT_FOUND 409 - CONFLICT 415 - UNSUPPORTED_MEDIA_TYPE 500 - SERVER_ERROR 503 - SERVICE_UNAVAILABLE 510 - INVALID_STATE 0 - UNKNOWN
In the end, I pass each response to a validation method that throws an exception:
private void checkResponse(SolrResponseBase response){ if(response.getStatus() != 0){ throw new RuntimeException(String.format("Solr-Response has error code %s",response.getStatus())); } }
source share