title: Solr: Sort results by relevance / distance
body: <p>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.</p>
  
  <pre><code>sort=div(query(deftype=edismax&amp;q=title:java&amp;title:developer), sum(1, geodist(location, x,y)))
  </code></pre>
  
  <p>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?</p>