cleanup search_json a bit
This commit is contained in:
parent
494947c15b
commit
eb9ee6965c
|
@ -12,18 +12,18 @@ def search(request):
|
||||||
|
|
||||||
def search_json(request):
|
def search_json(request):
|
||||||
search_term = request.GET.get("q", "")
|
search_term = request.GET.get("q", "")
|
||||||
threshold = float(request.GET.get("threshold", '0.5'))
|
threshold = request.GET.get("threshold", '0.5')
|
||||||
bbox = request.GET.get("bbox", False)
|
bbox = request.GET.get("bbox", False)
|
||||||
page = int(request.GET.get("page", '1'))
|
page = int(request.GET.get("page", '1'))
|
||||||
count = int(request.GET.get("count", '100'))
|
count = int(request.GET.get("count", '100'))
|
||||||
country = request.GET.get("adm0", "US") # right now, unused
|
country = request.GET.get("cc", "US") # right now, unused
|
||||||
adm1 = request.GET.get("adm1", "")
|
adm1 = request.GET.get("adm1", "")
|
||||||
adm2 = request.GET.get("adm2", "")
|
adm2 = request.GET.get("adm2", "")
|
||||||
srid = int(request.GET.get("srid", 4326))
|
srid = int(request.GET.get("srid", 4326))
|
||||||
|
|
||||||
if threshold:
|
if threshold:
|
||||||
try:
|
try:
|
||||||
threshold = float(threshold)
|
threshold = max(float(threshold), 0.1)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return render_to_json_response({'error': 'threshold must be a float'})
|
return render_to_json_response({'error': 'threshold must be a float'})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user