From abd06fc0e20db0f63f5b5c2837a3fce0dc795ab2 Mon Sep 17 00:00:00 2001 From: Schuyler Erle Date: Sun, 28 Aug 2011 09:31:23 +0200 Subject: [PATCH] Fixed broken .overlaps() query. --- 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 700af08..be19080 100644 --- a/gazetteer/places/models.py +++ b/gazetteer/places/models.py @@ -20,11 +20,11 @@ class FeatureSearchManager(models.GeoManager): def overlaps(self, (minx, miny, maxx, maxy), text=None, srid=4326): bbox = Polygon(((minx,miny),(minx,maxy),(maxx,maxy),(maxx,miny),(minx,miny)),srid=srid) if srid != 4326: bbox.transform(4326) # convert to lon/lat - qset = super(FeatureSearchManager, self).get_query_set().filter(geometry__bboverlaps=bbox) + qset = models.GeoManager.get_query_set(self).filter(geometry__bboverlaps=bbox) if text: text = text.replace("'", "''") # escape the ' # use the pg_trgm index - qset = qset.extra(where="[preferred_name %% '%s']" % text) + qset = qset.extra(where=["preferred_name %%%% '%s'" % text]) return qset class Feature(models.Model):