SchemaField makeSchemaField(String name) { // could have a cache instead of returning a new one each time, but it might // not be worth it. // Actually, a higher level cache could be worth it to avoid too many // .startsWith() and .endsWith() comparisons. it depends on how many // dynamic fields there are. return new SchemaField(prototype, name); }
private void informField (FieldDefinition xmlField, SolrCore core) { Map<String,SchemaField> schemaFields = schema.getFields(); Map<String,FieldType> fieldTypes = schema.getFieldTypes(); String fieldName = xmlField.getName(); if (schemaFields.containsKey(fieldName) && xmlField.getType() != Type.TOKENS) { // The Solr schema has a definition for this field, but it's not a TOKENS field: // We're only interested in TOKENS fields here; these need to install their own special field type since they wrap the // analyzer defined by the schema return; } // look up the type of this field using the mapping in this class FieldType fieldType = getFieldType(xmlField); if (! fieldTypes.containsKey(fieldType.getTypeName())) { // The Solr schema does not define this field type, so add it logger.info("{} defining fieldType: {}", core.getName(), fieldType.getTypeName()); fieldTypes.put(fieldType.getTypeName(), fieldType); } else { fieldType = fieldTypes.get(fieldType.getTypeName()); } // Add the field to the schema logger.info(core.getName() + " defining field: {} of type {}", fieldName, fieldType.getTypeName()); schemaFields.put(fieldName, new SchemaField (fieldName, fieldType, xmlField.getSolrFieldProperties(), "")); }
defaultValue = (String)props.get( "default" ); return new SchemaField(name, ft, p, defaultValue );
sf = new SchemaField( fname, new TextField() );
if (sf == null) { FieldType ft = new StrField(); sf = new SchemaField(field, ft);