You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Ian Eure <ia...@simplegeo.com> on 2011/05/13 19:09:30 UTC

Boosting score by distance

I have a bunch of documents representing points of interest indexed in Solr. I'm trying to boost the score of documents based on distance from an origin point, and having some difficulty.

I'm currently using the standard query parser and sending in this query:

(name:sushi OR tags:sushi OR classifiers:sushi) AND deleted:False AND owner:simplegeo

I'm also using the spatial search to limit results to ones found within 25km of my origin point. The issue I'm having is that I need the score to be a blend of the FT match _and_ distance from the origin point; If i sort by distance, lots of low quality matches clog up the results for simple searches, but if I sort by score, more distant results overwhelm nearby, though less relevant (according to Solr) results.

I think what I want to do is boost the score of documents based on the distance from the origin search point. Alternately, if there was some way to treat a match on any of the three fields as having equal weight, I believe that would get me much closer to what I want.

The examples I've seen for doing this kind of thing use dismax and its boost function (`bf') parameter. I don't know if my queries are translatable to dismax syntax as they are now, and it looks like the boost functions don't work with the standard query parser — at least, I have been completely unable to change the score when using it.

Is there some way to boost by the inverse of the distance using the standard query parser, or alternately, to filter my results by different fields with the dismax parser?