Affects Version/s: 5.2.1
Fix Version/s: None
Component/s: Schema and Analysis
lucene.document.FieldType#docValuesType() call always return non-null result which is protected by setter and copy constructor.
This method is used in solr.schema.FieldType#createFields(...) to enforce valid docValues type for field with docValues="true" in schema.
Current check is incorrect since it compares docValuesType to null which is always false.
In case of incorrectly implemented Solr FieldType which overrides checkSchemaField(...) to allow docValues and doesn't override createFields(...) it leads to buggy behavior: user thinks that field use docValues (since it's set in schema.xml and solr doesn't indicates any error), but really UninvertingReader with fieldValuesCache is used for faceting, grouping etc.
This issue is only present when user creates his own solr.schema.FieldType implementation because Solr FieldTypes which don't support docValues do not override checkSchemaField(...) method.
I will push pull request with patch and test case in several minutes.