Skip to content
Permalink
Browse files

Add limit for every table on wsgi search as default value and optiona…

…l parameter
  • Loading branch information...
uprel committed Sep 12, 2019
1 parent 6139116 commit 33bdbc8c082efa9e7168e787430b7b25d6b76cbb
Showing with 8 additions and 1 deletion.
  1. +8 −1 client/wsgi/search.wsgi
@@ -54,6 +54,11 @@ def application(environ, start_response):
sql = ""
errorText = ''

#limit
limit = '10'
if "limit" in request.params:
limit = request.params["limit"];

# any searchtable given?
if searchtableLength == 0:
errorText += 'error: no search table'
@@ -68,7 +73,7 @@ def application(environ, start_response):
data = ()
#for each table
for i in range(searchtableLength):
sql += "SELECT displaytext, '"+searchtables[i]+r"' AS searchtable, search_category, substring(search_category from 4) AS searchcat_trimmed, showlayer, "
sql += "(SELECT displaytext, '"+searchtables[i]+r"' AS searchtable, search_category, substring(search_category from 4) AS searchcat_trimmed, showlayer, "
# the following line is responsible for zooming in to the features
# this is supposed to work in PostgreSQL since version 9.0
sql += "'['||replace(regexp_replace(BOX2D(ST_Transform(the_geom,"+srs+"))::text,'BOX\(|\)','','g'),' ',',')||']'::text AS bbox "
@@ -91,6 +96,8 @@ def application(environ, start_response):

if j < querystringsLength - 1:
sql += " AND "

sql += " LIMIT " + limit + ")"
#union for next table
if i < searchtableLength - 1:
sql += " UNION "

0 comments on commit 33bdbc8

Please sign in to comment.
You can’t perform that action at this time.