Example usage for org.apache.solr.client.solrj.response.schema SchemaRepresentation getCopyFields

List of usage examples for org.apache.solr.client.solrj.response.schema SchemaRepresentation getCopyFields

Introduction

In this page you can find the example usage for org.apache.solr.client.solrj.response.schema SchemaRepresentation getCopyFields.

Prototype

public List<Map<String, Object>> getCopyFields() 

Source Link

Usage

From source file:org.apache.storm.solr.schema.builder.RestJsonSchemaBuilderV2.java

License:Apache License

private List<CopyField> getCopyFields(SchemaRepresentation schemaRepresentation) {
    List<CopyField> copyFields = new LinkedList<>();
    for (Map<String, Object> map : schemaRepresentation.getCopyFields()) {
        CopyField cp = new CopyField();
        cp.setSource((String) map.get("source"));
        cp.setDest((String) map.get("dest"));
        copyFields.add(cp);/*from w  ww  .j a v  a 2s.com*/
    }
    return copyFields;
}

From source file:org.springframework.data.solr.core.schema.DefaultSchemaOperations.java

License:Apache License

@Override
public SchemaDefinition readSchema() {

    SchemaRepresentation representation = template.execute(
            solrClient -> new SchemaRequest().process(solrClient, collection).getSchemaRepresentation());

    SchemaDefinition sd = new SchemaDefinition(collection);

    for (Map<String, Object> fieldValueMap : representation.getFields()) {
        sd.addFieldDefinition(FieldDefinition.fromMap(fieldValueMap));
    }/*www.j  av  a  2 s.c  o m*/
    for (Map<String, Object> fieldValueMap : representation.getCopyFields()) {

        CopyFieldDefinition cf = CopyFieldDefinition.fromMap(fieldValueMap);
        sd.addCopyField(cf);

        if (sd.getFieldDefinition(cf.getSource()) != null) {
            sd.getFieldDefinition(cf.getSource()).setCopyFields(cf.getDestination());
        }
    }

    return sd;
}