geo_dist_match

geo_dist_match(str fieldname, float thresh)allows comparison between fields that contain GEO coordinates. The function returns True if the distance between the coordinates is smaller than thresh, and False otherwise.

Input

  • fieldname (str) - the name of the field to match in query document and database document. params[fieldname] and doc[fieldname] must be of type tuple(float)

  • thresh(float) - the distance threshold

Output

  • match (Boolean) - true if geo_distance(doc[fieldname],params[fieldname]) < thresh, and False otherwise.

Example:

def score_function(params, doc)
   score = 0.0
   if geo_dist_match("geolocation", 45.02):
      score = 1.0
   return score

Last updated