Affects Version/s: 7.6, 8.6.3
Fix Version/s: None
Macros in a request handler's appends or invariants parameter sets are not getting expanded when running in a SolrCloud setup.
In my case, I have a handler like the following:
When querying the handler with `?my_term=foobar&echoParams=all`, something like this is the result:
As you can see, the macro in the appends fl parameter gets expanded in the responseHeader.params.fl field, but not in the actual document.
I believe the reason for this is the following:
- Setting of defaults/invariants/appends happens once before the request gets sent to the shards
- Here, macro expansion happens, i.e. the shards get the fully expanded parameters
- On the shards, once again, defaults/invariants/appends are set (https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java#L209)
- However, this time macros are not expanded (https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/request/json/RequestUtil.java#L151-L161)
- For defaults parameters, this doesn't break anything, since the (expanded) parameter from the request takes precedence over the server-supplied value.
- However, for appends, both the expanded and the unexpanded version are now set, while for invariants the expanded value is removed from the params
I think the easy/obvious fix for this would be not to set defaults/invariants/appends parameters twice, i.e. disable it when isShard=true, just like macro expansion, but I don't have the full picture if that might not break something else.
Here's the Twitter thread where I rubber-ducked through this issue: https://twitter.com/jbaiter_/status/1316023733576843272