From da145488496d50b47c580ece68644cd57aa09038 Mon Sep 17 00:00:00 2001 From: Schuyler Erle Date: Wed, 31 Aug 2011 03:46:26 -0700 Subject: [PATCH] fix SQL replacement syntax --- gazetteer/places/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gazetteer/places/models.py b/gazetteer/places/models.py index 1c0bc8d..732b7c1 100644 --- a/gazetteer/places/models.py +++ b/gazetteer/places/models.py @@ -35,9 +35,9 @@ class FeatureSearchManager(models.GeoManager): self.set_threshold(threshold) text = text.replace("'", "''") # escape the ' # use the pg_trgm index - qset = qset.extra(select={"similarity":"similarity(preferred_name, '%s')"}, + qset = qset.extra(select={"similarity":"similarity(preferred_name, %s)"}, select_params=[text], - where=["preferred_name %% '%s'"], + where=["preferred_name %% %s"], params=[text], order_by=["-similarity"]) if adm1: qset = qset.filter(admin1__exact=adm1)