public SchemaDef add(SearchField field) {
        try {
            noFieldShadowing(field.getName());
            fields.put(field.getName(), field);
        } catch (IllegalArgumentException e) {
            if (indexNames.contains(field.getName())) {
                 throw e;
            }
        }
        return this;
    }
Adds a search field to the schema.

@param field the field to add
@return this, for chaining
config-model/src/main/java/com/yahoo/vespa/documentmodel/SchemaDef.java