mmmm debugging I confirm you are right Yonik, but also that the defaults
are already applied at this point :
org/apache/solr/request/json/RequestUtil.java:158

Could be a resolution of properties that happens at solrconfig, xml level ?
It verifies if any java properties is in there when running solr, and
because of that the defaults are already applied ?

Cheers

On 30 December 2015 at 15:20, Alessandro Benedetti <abenede...@apache.org>
wrote:

> Erick,
> your suggestion worked :
>
> <requestHandler name="/getSimilar" class="solr.SearchHandler">
>     <lst name="defaults">
>         <!-- Query settings -->
>         <str name="title">Hotels Similarity</str>
>         <str name="defType">edismax</str>
>         <str name="rows">5</str>
>         <str name="fl">*,score</str>
>         <str name="fq">active:true</str>
>         <str name="echoParams">explicit</str>
>         <str name="wt">json</str>
>         <str name="q">{!boost 
> b=recip(dist(2,0,star_rating,0,$star_rating),1,10,10)}{!boost 
> b=recip(geodist(lat_lon,$lat,$lon),2,200,20)}{!mlt 
> qf=name,description,facilities,resort,region,dest_level_2 mintf=1 mindf=5 
> maxqt=50 v=$master_id}</str>
>         <!-- Default Similarity Parameters-->
>         <str name="master_id">0</str>
>         <str name="star_rating">3</str>
>         <str name="lat">0</str>
>         <str name="lon">0</str>
>     </lst>
> </requestHandler>
>
> Yonik, running debugQuery=on i verified that the default were added
> before, so basically I can see the default replaced but the one I am
> sending in the request param take no effect ( as actually the macro
> disappeared , replaced by the default) .
> Is maybe because I am inside a block with different query parsers ?
>
> Cheers
>
>
> On 30 December 2015 at 15:14, Yonik Seeley <ysee...@gmail.com> wrote:
>
>> 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
>>
>
>
>
> --
> --------------------------
>
> Benedetti Alessandro
> Visiting card : http://about.me/alessandro_benedetti
>
> "Tyger, tyger burning bright
> In the forests of the night,
> What immortal hand or eye
> Could frame thy fearful symmetry?"
>
> William Blake - Songs of Experience -1794 England
>



-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Reply via email to