Example usage for org.springframework.data.solr.core.schema SchemaDefinition getFields

List of usage examples for org.springframework.data.solr.core.schema SchemaDefinition getFields

Introduction

In this page you can find the example usage for org.springframework.data.solr.core.schema SchemaDefinition getFields.

Prototype

public List<FieldDefinition> getFields() 

Source Link

Usage

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

protected void updateSchema(SchemaDefinition schemaDefinition) {

    SchemaDefinition existing = loadExistingSchema(schemaDefinition.getCollectionName());

    List<FieldDefinition> fieldsToBeCreated = new ArrayList<FieldDefinition>();
    for (FieldDefinition fieldDefinition : schemaDefinition.getFields()) {
        if (!existing.containsField(fieldDefinition.getName())) {
            fieldsToBeCreated.add(fieldDefinition);
        }/*from  w  w w.jav  a2s .  c  o  m*/
    }

    writeFieldDefinitions(fieldsToBeCreated, schemaDefinition.getCollectionName());
}