Parameter Substitution or Macro Expansion is a request templating mechanism that works for search requests across all request parameters, including any JSON body that may be passed via the JSON Request API.
The macro expansion is done at the same point in time that default parameters are applied (i.e. when the request reaches the correct request handler). This means that request handler defaults, appends, and invariants configured for the handler may reference request parameters, and vice-versa.
Here’s a very simple example of parameterizing a range query in lucene/solr syntax:
One can also specify default values:
Substitutions can themselves contain further macro expansions:
If you want to disable macro expansion, simply pass
expandMacros=false as a request parameter.
This page was adapted from http://yonik.com/solr-query-parameter-substitution/