fix SQL replacement syntax
This commit is contained in:
parent
79aca4260f
commit
da14548849
1 changed files with 2 additions and 2 deletions
|
@ -35,9 +35,9 @@ class FeatureSearchManager(models.GeoManager):
|
||||||
self.set_threshold(threshold)
|
self.set_threshold(threshold)
|
||||||
text = text.replace("'", "''") # escape the '
|
text = text.replace("'", "''") # escape the '
|
||||||
# use the pg_trgm index
|
# 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],
|
select_params=[text],
|
||||||
where=["preferred_name %% '%s'"],
|
where=["preferred_name %% %s"],
|
||||||
params=[text],
|
params=[text],
|
||||||
order_by=["-similarity"])
|
order_by=["-similarity"])
|
||||||
if adm1: qset = qset.filter(admin1__exact=adm1)
|
if adm1: qset = qset.filter(admin1__exact=adm1)
|
||||||
|
|
Loading…
Add table
Reference in a new issue