Java Code Examples for org.apache.solr.client.solrj.response.UpdateResponse#getRequestUrl()

The following examples show how to use org.apache.solr.client.solrj.response.UpdateResponse#getRequestUrl() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SolrController.java    From Spring-Boot-Book with Apache License 2.0 6 votes vote down vote up
@RequestMapping("/delById/{id}")
public String delById(@PathVariable("id") String id) throws IOException, SolrServerException {
    //根据id删除信息
    UpdateResponse updateResponse = solrClient.deleteById(id);
    //执行的时间
    long elapsedTime = updateResponse.getElapsedTime();

    int qTime = updateResponse.getQTime();
    //请求地址
    String requestUrl = updateResponse.getRequestUrl();
    //请求的结果{responseHeader={status=0,QTime=2}}
    NamedList<Object> response = updateResponse.getResponse();
    //请求结果的头{status=0,QTime=2}
    NamedList responseHeader = updateResponse.getResponseHeader();
    //请求的状态 0
    solrClient.commit();
    int status = updateResponse.getStatus();
    //成功则返回0.要是没有文档被删除也会返回0,代表根本没有
    return status == 0 ? "success" : "failed";
}
 
Example 2
Source File: SolrControllerTest.java    From Spring-Boot-Book with Apache License 2.0 6 votes vote down vote up
@Test
public void delById()  throws IOException, SolrServerException {
    //根据id删除信息
    UpdateResponse updateResponse = solrClient.deleteById("8888888");
    //执行的时间
    long elapsedTime = updateResponse.getElapsedTime();
    int qTime = updateResponse.getQTime();
    //请求地址
    String requestUrl = updateResponse.getRequestUrl();
    //请求的结果{responseHeader={status=0,QTime=2}}
    NamedList<Object> response = updateResponse.getResponse();
    //请求结果的头{status=0,QTime=2}
    NamedList responseHeader = updateResponse.getResponseHeader();
    //请求的状态 0
    solrClient.commit();
    int status = updateResponse.getStatus();
    //成功则返回0.要是没有文档被删除也会返回0,代表根本没有

}