From 4d578c156d979abd5945c118066d1ec7a9779c70 Mon Sep 17 00:00:00 2001 From: Schuyler Erle Date: Thu, 1 Sep 2011 09:31:55 +0200 Subject: [PATCH] Add flexible threshold, bump up max_distance a bit. --- gazetteer/places/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gazetteer/places/models.py b/gazetteer/places/models.py index 192bc69..1435632 100644 --- a/gazetteer/places/models.py +++ b/gazetteer/places/models.py @@ -106,7 +106,8 @@ class Feature(models.Model): return '' time_end.short_description = "End Date" - def similar_features(self, max_distance=15000, scale_factor=2000, limit=20): + def similar_features(self, max_distance=30000, scale_factor=2000, threshold=0.35, limit=20): + type(self).search.set_threshold(threshold) sql = """ SELECT *, %s * similarity / (distance + 1.0) AS score FROM ( SELECT f.*, r.feature1_id, r.feature2_id, r.relationship_type,