Add flexible threshold, bump up max_distance a bit.

This commit is contained in:
Schuyler Erle 2011-09-01 09:31:55 +02:00
parent 0a4bae4b43
commit 4d578c156d

View File

@ -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,