What's wrong with this?
q=cats&bq={!edismax qf=title v=$q}
Well it turns out that the local params carries the external params with it. So the bq will get applied to itself, resulting in "Infinite Recursion Errors".
The fix is:
q=cats&bq={!edismax qf=title v=$q bq=}
You will have similar issues if you have a query within a boost function, ie:
q=cats&qqq={!edismax qf=title v=$q bq=}&bf=query($qqq)
You need to stub out bq and bf, but ah herein lies the rub (isn't Solr awesome) you need to stub out the first param differently than the last.
This won't do what you think:
q=cats&qqq={!edismax qf=title v=$q bq= bf=}&bf=query($qqq)
Instead you need to do:
q=cats&qqq={!edismax qf=title v=$q bq='' bf=}&bf=query($qqq)
And no this doesn't appear to do the same thing
q=cats&qqq={!edismax qf=title v=$q bq='' bf=''}&bf=query($qqq)
Oh Solr you're fun :)
Solr 5.1 introduced a different macro substitution synatx. As opposed to parameter substitution, $q
, this is more of a templating system letting you sprinkle {$q}
or {$qqq}
wherever you want. IE:
bq={!complexphrase df=title}"${q}"
Now you'd think you could port it to your Solrconfig:
<str name="bq">{!complexphrase df=title}"${q}"</str>
But this gives an error:
Error: org.apache.solr.common.SolrException: No system property or default value specified for q value:{!complexphrase df=title}"${q}"
This is because ${q}
syntax overlaps with solrconfigs Java property syntax.
To fix, set the default value for the Java property to ${q}
:
<str name="bq">{!complexphrase df=title}"${q:${q}}"</str>
Gotta love Solr!
So, I had been assuming that bq= and bq='' meant the same thing. Apparently not!? I'm anxiously waiting for your "episode #2" of this topic where you explain the differences between the last two expressions. :-)