Class ManagedSchemaDiff

java.lang.Object
org.apache.solr.handler.designer.ManagedSchemaDiff

public class ManagedSchemaDiff extends Object
Utility methods for comparing managed index schemas
  • Constructor Details

    • ManagedSchemaDiff

      public ManagedSchemaDiff()
  • Method Details

    • diff

      public static Map<String,Object> diff(ManagedIndexSchema oldSchema, ManagedIndexSchema newSchema)
      Compute difference between two managed schemas. The returned map consists of changed, new, removed elements in fields, field types, dynamic fields and copy fields between input schemas.
       Output format when rendered to json will look like below:
         
         {
           "fields": {
             "updated": {...},
             "added": {...},
             "removed": {...}
           },
           "fieldTypes": {
             "updated": {...},
             "added": {...},
             "removed": {...}
           },
           "dynamicFields": {
             "updated": {...},
             "added": {...},
             "removed": {...}
           },
           "copyFields: {
             "new": [...],
             "old": [...]
           }
         }
         
       
      Parameters:
      oldSchema - instance of ManagedIndexSchema
      newSchema - instance of ManagedIndexSchema
      Returns:
      the difference between two schemas
    • diff

      protected static Map<String,Object> diff(Map<String,org.apache.solr.common.util.SimpleOrderedMap<Object>> map1, Map<String,org.apache.solr.common.util.SimpleOrderedMap<Object>> map2)
      Compute difference between two map objects with SimpleOrderedMap as values.
       Example of the output format when rendered to json
         
          {
            "updated": {
              "stringField": [
              {
                "docValues": "false"
              },
              {
                "docValues": "true"
              }
            },
            "added": {
              "newstringfield: {
                "name": "newstringfield",
                "type": "string",
                .....
              }
            },
            "removed": {
              "oldstringfield": {
                "name": "oldstringfield",
                "type": "string",
                .....
              }
            }
          }
         
       
      Parameters:
      map1 - instance of Map with SimpleOrderedMap elements
      map2 - instance of Map with SimpleOrderedMap elements
      Returns:
      the difference between two Map
    • diff

      protected static Map<String,Object> diff(List<org.apache.solr.common.util.SimpleOrderedMap<Object>> list1, List<org.apache.solr.common.util.SimpleOrderedMap<Object>> list2)
    • mapFieldsToPropertyValues

      protected static Map<String,org.apache.solr.common.util.SimpleOrderedMap<Object>> mapFieldsToPropertyValues(Map<String,SchemaField> fields)
    • mapFieldTypesToPropValues

      protected static Map<String,org.apache.solr.common.util.SimpleOrderedMap<Object>> mapFieldTypesToPropValues(Map<String,FieldType> fieldTypes)
    • mapDynamicFieldToPropValues

      protected static Map<String,org.apache.solr.common.util.SimpleOrderedMap<Object>> mapDynamicFieldToPropValues(IndexSchema.DynamicField[] dynamicFields)
    • getCopyFieldList

      protected static List<org.apache.solr.common.util.SimpleOrderedMap<Object>> getCopyFieldList(ManagedIndexSchema indexSchema)