How to boost a search if the result of a function

2019-05-20 19:35发布

问题:

I have a form where someone who make a deliver choose, on a map, his location and then he sets the radius that he is attending.

When a user comes to my site, he can perform a query and I want to boost the sellers that attend the location of the client.

Basicaly, I need to do a HSIN function on solr between the seller and the client point and boost if the result is less then the radius.

Boost Function allows me to boost by the result of the query (witch is not the case) and Boost Query does not allow me to use a function as the range (for example: map_area_radius_f:[* TO HSIN(...)]^6.0)

Can you guys help me?

Edit: Jpountz asked for the syntax I'm using, but it is not working anyway. I tryed something like

bq=[* TO HSIN(6371000, 1, map_area_latitude, map_area_longitude, params[:latitude], params[:longitude])]^6.0

but it raises a parse error. PS: 6371000 is the earth radius in meters.

Thank you.

标签: solr