Example usage for org.apache.solr.core SolrCore setLatestSchema

List of usage examples for org.apache.solr.core SolrCore setLatestSchema

Introduction

In this page you can find the example usage for org.apache.solr.core SolrCore setLatestSchema.

Prototype

public void setLatestSchema(IndexSchema replacementSchema) 

Source Link

Document

Sets the latest schema snapshot to be used by this core instance.

Usage

From source file:com.searchbox.engine.solr.EmbeddedSolr.java

License:Apache License

private boolean addCopyFields(Collection collection, Field field, Set<String> copyFields) {
    SolrCore core = coreContainer.getCore(collection.getName());
    IndexSchema schema = core.getLatestSchema();

    for (CopyField copyField : schema.getCopyFieldsList(field.getKey())) {
        copyFields.remove(copyField.getDestination().getName());
    }/*  w  w w  .  j av a  2 s .com*/

    Map<String, java.util.Collection<String>> copyFieldsMap = new HashMap<String, java.util.Collection<String>>();
    copyFieldsMap.put(field.getKey(), copyFields);
    schema = schema.addCopyFields(copyFieldsMap);

    core.setLatestSchema(schema);

    return true;
}