Package org.apache.solr.client.solrj.response

Examples of org.apache.solr.client.solrj.response.UpdateResponse


    Mockito.verify(solrServerMock, Mockito.times(1)).add(Mockito.eq(collection), Mockito.eq(10000));
  }

  @Test
  public void testDeleteById() throws IOException, SolrServerException {
    Mockito.when(solrServerMock.deleteById(Mockito.anyString())).thenReturn(new UpdateResponse());
    UpdateResponse updateResponse = solrTemplate.deleteById("1");
    Assert.assertNotNull(updateResponse);
    Mockito.verify(solrServerMock, Mockito.times(1)).deleteById(Mockito.eq("1"));
  }
View Full Code Here


    Mockito.verify(solrServerMock, Mockito.times(1)).deleteById(Mockito.eq("1"));
  }

  @Test
  public void testDeleteByIdWithCollection() throws IOException, SolrServerException {
    Mockito.when(solrServerMock.deleteById(Mockito.anyListOf(String.class))).thenReturn(new UpdateResponse());
    List<String> idsToDelete = Arrays.asList("1", "2");
    UpdateResponse updateResponse = solrTemplate.deleteById(idsToDelete);
    Assert.assertNotNull(updateResponse);

    @SuppressWarnings("unchecked")
    ArgumentCaptor<List<String>> captor = (ArgumentCaptor<List<String>>) (Object) ArgumentCaptor.forClass(List.class);
View Full Code Here

                    int count = qrsp.getResults().size();
                   
                    if (count > 0)
                    {
                        // Remove the document from search index
                        UpdateResponse rsp = server.deleteByQuery(queryString);
                       
                        if (rsp.getStatus() < 300)
                        {
                            deleteCount += count;
                        }
                    }
                }
View Full Code Here

                    query.setQuery(queryString);
                    QueryResponse qrsp = server.query(query);
                   
                    if (!qrsp.getResults().isEmpty())
                    {
                        UpdateResponse ursp = server.deleteByQuery(queryString);
                       
                        if (ursp.getStatus() < 300)
                        {
                            server.commit();
                        }
                    }
                }
View Full Code Here

        List<SolrInputDocument> docs = getSolrInputDocuments(list);
        //批量提交索引
        try{
            LOG.info("开始批量提交索引文档");
            solrServer.add(docs);
            UpdateResponse updateResponse = solrServer.commit();    
            int status = updateResponse.getStatus();
            if(status==0){
                LOG.info("成功为Core: "+core+" 提交 "+docs.size()+" 个文档");
            }else{
                LOG.info("索引提交失败,status:"+status);
            }
            LOG.info("ResponseHeader:\n"+updateResponse.getResponseHeader().toString());
            LOG.info("Response:\n"+updateResponse.getResponse().toString());
            //加速内存释放
            docs.clear();
        }catch(IOException | SolrServerException e){
            LOG.error("批量提交索引失败", e);
        }
View Full Code Here

TOP

Related Classes of org.apache.solr.client.solrj.response.UpdateResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.