On Wed, Dec 30, 2015 at 8:37 AM, Alessandro Benedetti
<abenede...@apache.org> wrote:
> I was taking a look to this article from Yonik [1] .
> I like the feature and actually it could useful for some use cases of mine.
> Started to play with it in Solr 5.4 .
>
> I verified it is working if you pass both the query and the parameters to
> substitute as request parameters.
>
> I verified it is working if you pass both the query and the parameters to
> substitute as defaults or appends for the request handler.
>
> Currently I am not able to make it working the following scenario :
> solrconfig.xml
>
> <requestHandler name="/getSimilar" class="solr.SearchHandler">
>>           <lst name="defaults">
>>                ...
>>               <str name="q">{!boost b=recip(dist(2,0,star_rating,0,
>> *${star_rating:3}*),1,10,10)}{!boost b=recip(geodist(lat_lon,*${lat:0}*,
>> *${lon:0}*),2,200,20)}{!mlt
>> qf=name,description,facilities,resort,region,dest_level_2 mintf=1 mindf=5
>> maxqt=50}*${master_id:0}*</str>
>>                ...
>>           </lst>
>>       </requestHandler>
>
>
>
> Then I pass in the request the parameter to substitute , like :
> master_id=1 .
> Unfortunately is always getting the default one.

Hmmm, that's odd.
Macro expansion is done after defaults/appends/invariants are added to
the params, so it should work (although we lack a test for this).

See RequestUtil.java:
  newMap = MacroExpander.expand(newMap);

If you add echoParams=all to your request, that currently shows the
params post-expansion to verify you're actually getting the default.

-Yonik

Reply via email to