Case-insensitive searching

This commit is contained in:
Ilya Zverev 2016-02-20 12:12:30 +03:00
parent 402bc4d998
commit fc376dfa7a

View file

@ -178,7 +178,7 @@ def check_osm_table():
def search():
query = request.args.get('q').encode('utf-8')
cur = g.conn.cursor()
cur.execute('select ST_XMin(geom), ST_YMin(geom), ST_XMax(geom), ST_YMax(geom) from borders where name like %s limit 1', ('%{0}%'.format(query),))
cur.execute('select ST_XMin(geom), ST_YMin(geom), ST_XMax(geom), ST_YMax(geom) from borders where name ilike %s limit 1', ('%{0}%'.format(query),))
if cur.rowcount > 0:
rec = cur.fetchone()
return jsonify(bounds=[rec[0], rec[1], rec[2], rec[3]])