solr icon indicating copy to clipboard operation
solr copied to clipboard

always(?) use SolrCore.getLatestSchema in RealTimeGetComponent

Open cpoerschke opened this issue 3 years ago • 3 comments
trafficstars

The RealTimeGetComponent uses getLatestSchema in 12 places and getSchema in 2 places.

Intuitively I would expect getSchema to be used throughout since it as per https://github.com/apache/solr/blob/releases/solr/9.0.0/solr/core/src/java/org/apache/solr/request/SolrQueryRequest.java#L86-L87 that is snapshot at request creation and so logically cannot change during processing. But based on 12:2 ratio perhaps getLatestSchema is equally suitable?

This pull request is to always use getLatestSchema or to add clarifying comments w.r.t. why some places use one API and others use the other in the component.

cpoerschke avatar Aug 22 '22 16:08 cpoerschke

For code activated from a request, I think the code should use a consistent schema for that request. Thus I think RTG should be using req.getSchema() in those 10 places.

dsmiley avatar Aug 23 '22 03:08 dsmiley

I noticed that SpellCheckComponent and QueryElevationComponent also use getLatestSchema... in fact, looking where getLatestSchema (92 times) versus getSchema (173 times) happens is an interesting mish mash of places.

epugh avatar Aug 23 '22 14:08 epugh

Let's close this or fundamentally change it?

dsmiley avatar Sep 12 '22 19:09 dsmiley