I would like to sort results from a Solr query by their relevance divided by their geo distance from a point. I have tried boosting by 1/distance (using the boost param with edismax) and various variants of this. The problem with this is that depending on the query, the relative weight of the boost varies (e.g. a long query versus a very short one). So I would ideally like to be able to have the distance have the same effect on all queries, as I am building a recommender engine. I can't use MLT as it also does not allow for you to incorporate distance into the MLT request, only doc similarity, to my knowledge. The only way I can think to do this is to embed the entire query into a query function in the sort, e.g.
sort=div(query(deftype=edismax&q=title:java&title:developer), sum(1, geodist(location, x,y)))
The full query is actually much longer, and it seems ridiculous to have it compute the document relevance again in the sort. Is there a better way to do this? Is there a better way to leverage geospatial boosting so that the boost is always proportional to the rest of the query?
bf
param? (The Solr reference guide provides this example of boosting nearby results:&q.alt=*:*&fq={!geofilt}&sfield=store&pt=45.15,-93.85&d=50&bf=recip(geodist(),2,200,20)&sort=score desc
) – femtoRgonbf
,bq
orboost
params?bf
andbq
should apply an additive boost (which sounds like what you are describing), andboost
should give you a multiplicative boost (which, I believe, is what you want). – femtoRgon