From 7d89c8e7a9a50e2b4d8ca5e1a40a1e1f339b9533 Mon Sep 17 00:00:00 2001 From: diSabler Date: Mon, 20 Oct 2014 21:02:41 +0400 Subject: fix: limit for gis output --- plugins/gis.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/gis.py b/plugins/gis.py index f004a17..e21e4be 100644 --- a/plugins/gis.py +++ b/plugins/gis.py @@ -21,6 +21,8 @@ # # # --------------------------------------------------------------------------- # +gis_limit = 20 + def gweather_raw(type, jid, nick, text, fully): def get_date(body): tmp = get_tag_item(body,'FORECAST','day')+'.'+get_tag_item(body,'FORECAST','month') @@ -48,10 +50,10 @@ def gweather_raw(type, jid, nick, text, fully): if len(text.strip()): text = text.lower() - wzc = cur_execute_fetchall('select * from gis where code ilike %s or lcity ilike %s',(text,text)) + wzc = cur_execute_fetchall('select * from gis where code ilike %s or lcity ilike %s limit %s',(text,text,gis_limit)) if not wzc: ttext = '%%%s%%' % text - wzc = cur_execute_fetchall('select * from gis where code ilike %s or lcity ilike %s',(ttext,ttext)) + wzc = cur_execute_fetchall('select * from gis where code ilike %s or lcity ilike %s limit %s',(ttext,ttext,gis_limit)) if not wzc and text.isdigit() and 4 <= len(text) <= 5: wzc = [(text,'','')] if wzc: if len(wzc) == 1: -- cgit v1.2.3