I'm struggling to wrap my brain around local params in solr. When would you actually use them to do things like q.op? How is ?q={!q.op=OR}solr rocks different from ?q=solr rocks&q.op=OR and when would it be useful. The main thing I can think is if you only have access to the q= param via whatever api or lib you are using. Is it mainly for nesting more complex searches, if so, is there an example somewhere in the docs?
It also appears that some params are just inherently different, like {!boost... vs bq/bf, but I still don't see why you couldn't/shouldn't be able to do something like ?q=solr rocks&boost=[some boost thing] if the local params are fairly interchangeable.
Is there something I'm misunderstanding in this process?
The important part is "certain argument types". This means that it's not only valid for the
qparameter.The examples you've given above can also be used with the
fqparameter, for example to use a dismax search query as thefq:Another very useful thing is to be able to tag and exclude
fqparameters when creating facets - i.e. allow you to filter the result set without filtering the documents used for the facets:Here the
{!tag}and{!ex}parameters change something for that specific parameter and not for the whole query (which a query parameter would do).It's also useful when decoupling the parameters with the parameter dereferencing support, which means that you can lock the parameter itself (and its argument) through the use of
invariantfor the query parameter in solrconfig, then use the new query argument to send the actual user supplied string in to the query:In this case you can lock the
qparameter to whatever given above, then only supply the query string throughqq.There are many, many other examples of using localparams to change how one specific query argument behaves, but hopefully this will give you an idea of why and how to use them.