Exemple #1
0
 @Test
 public void deleteCopyFieldShouldFailWhenOneOfTheFieldsDoesntExistInTheSchema() throws Exception {
   String srcFieldName = "copyfield";
   String destFieldName1 = "destField1", destFieldName2 = "destField2";
   SchemaRequest.DeleteCopyField deleteCopyFieldsRequest =
       new SchemaRequest.DeleteCopyField(
           srcFieldName, Arrays.asList(destFieldName1, destFieldName2));
   SchemaResponse.UpdateResponse deleteCopyFieldResponse =
       deleteCopyFieldsRequest.process(getSolrClient());
   assertNotNull(deleteCopyFieldResponse.getResponse().get("errors"));
 }
Exemple #2
0
  @Test
  public void testDeleteCopyFieldAccuracy() throws Exception {
    String srcFieldName = "copyfield";
    String destFieldName1 = "destField1", destFieldName2 = "destField2";
    createStoredStringField(srcFieldName, getSolrClient());
    createStoredStringField(destFieldName1, getSolrClient());
    createStoredStringField(destFieldName2, getSolrClient());

    SchemaRequest.AddCopyField addCopyFieldRequest =
        new SchemaRequest.AddCopyField(srcFieldName, Arrays.asList(destFieldName1, destFieldName2));
    SchemaResponse.UpdateResponse addCopyFieldResponse =
        addCopyFieldRequest.process(getSolrClient());
    System.out.println(addCopyFieldResponse);
    assertValidSchemaResponse(addCopyFieldResponse);

    SchemaRequest.DeleteCopyField deleteCopyFieldRequest1 =
        new SchemaRequest.DeleteCopyField(srcFieldName, Arrays.asList(destFieldName1));
    assertValidSchemaResponse(deleteCopyFieldRequest1.process(getSolrClient()));

    SchemaRequest.DeleteCopyField deleteCopyFieldRequest2 =
        new SchemaRequest.DeleteCopyField(srcFieldName, Arrays.asList(destFieldName2));
    assertValidSchemaResponse(deleteCopyFieldRequest2.process(getSolrClient()));
  }