Ahmet: thanks for raising this issue, and for your patch.
you didn't mention it in jira, but in your linked email you suggested that the method being tested (docListToSolrDocumentList) isn't actually doing what it's suppose to...
Regardless of Set<String> fields parameter, SolrPluginUtils#docListToSolrDocumentList method loads all of the stored fields. Shouldn't it just load the fields given in the set? Should I file a jira ticket?
Digging deeper, i found two problems...
- docListToSolrDocumentList is delegating the field list to SolrIndexSearcher.doc, which means those fields are read immediately, but the rest of the fields will be lazy loaded
- docListToSolrDocumentList is calling DocumentBuilder.loadStoredFields which loads all of the fields – regardless of which field list was passed to docListToSolrDocumentList
- docListToSolrDocumentList has some really bizare code in it, preventing stored fields from being returned if they are the result of a copyField.
Since there are no other usages of DocumentBuilder.loadStoredFields in Solr, it's not clear to me what the intended point of it's crazy logic was