I was able to get it to work kinda with a map().

http://localhost:8983/solr/select?q=*:*&radius=1&b=
<http://localhost:8983/solr/select?q=*:*&radius=national&b=if(equals($radius,%27national%27),0,geodist())>
map($radius,1,1,0,geodist())

Where 1= National

Do you have an example of a SearchComponent? It would be pretty easy to
copy map() and develop an equals() right?

if(equals($radius, 'national'), 0, geodist())

This would probably be useful for everyone.

On Tue, Nov 10, 2015 at 4:05 PM, Jan Høydahl <jan....@cominvent.com> wrote:

> Where is your “b” parameter used? I think that instead of trying to set a
> new “b” http param (which solr will not evaluate as a function), you should
> instead try to insert your function or switch qParser directly where the
> “b” param is used, e.g. in a bq or similar.
>
> A bit heavy weight, but you could of course write a custom SearchComponent
> to construct your “b” parameter...
>
> --
> Jan Høydahl, search solution architect
> Cominvent AS - www.cominvent.com
>
> > 10. nov. 2015 kl. 23.52 skrev William Bell <billnb...@gmail.com>:
> >
> > We are trying to look at a value, and change another value based on that.
> >
> > For example, for national search we want to pass in radius=national, and
> > then set another variable equal to 0, else set the other variable = to
> > geodist() calculation.
> >
> > We tried {!switch} but this only appears to work on fq/q. There is no
> > function for constants for equals....
> >
> >
> http://localhost:8983/solr/select?q=*:*&radius=national&b=if(equals($radius,'national'),0,geodist())
> >
> > This does not work:
> >
> > http://localhost:8983/solr/select?q=*:*&radius=national&b={!switch
> > case.national=0 default=geodist() v=$radius}
> >
> > Ideas?
> >
> >
> >
> > --
> > Bill Bell
> > billnb...@gmail.com
> > cell 720-256-8076
>
>


-- 
Bill Bell
billnb...@gmail.com
cell 720-256-8076

Reply via email to