I'm attaching a modified patch:
You switched TestBulkSchemaAPI to using the to-be-deprecated (
SOLR-6594) non-bulk API, via extra servlet setup in before(), AFAICT so that you could get the showDefaults behavior, which is not available with the bulk Schema API. But this is a bug in FieldType.getNamedPropertyValues(): it only outputs similarity when showDefaults=true, but it should instead always do so. My version of the patch fixes this bug. (This is a round-tripping problem: manual testing shows that when managed schema is persisted, per-field-type similarity is currently dropped, which is bad.)
I was then able to revert TestBulkSchemaAPI to the previously used bulk schema API, since showDefaults is no longer necessary to get the per-field-type similarity to show up in the schema api response.
I think this is ready. I'll commit after running Solr tests and precommit.
In my testing I noticed that SchemaSimilarityFactory, a prerequisite for setting per-field-type similarity, is not the default in any of Solr's example schemas. See http://markmail.org/message/7icpmwmdhfw4tmwv and
SOLR-3577 for rationale.
We need to let people know that in order to set per-field-type similarity, they need to first set the global similarity to SchemaSimilarityFactory or something like it. Unfortunately the Schema API can't yet set the global similarity - see SOLR-7242. I'll leave a comment there about the need to check/update the Solr Reference Guide for this.