How to boost a search if the result of a function is less than a field?

那年仲夏 提交于 2019-12-22 23:47:45

问题


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.

来源:https://stackoverflow.com/questions/8348407/how-to-boost-a-search-if-the-result-of-a-function-is-less-than-a-field

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!