Skip to content

Commit 1aed751

Browse files
committed
Added alias endpoint for reverse geocoding (#52)
1 parent abe752e commit 1aed751

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Diff for: web/websearch.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ def process_search_index(index, query, query_filter, start=0, count=0, field_wei
250250
if len(sortBy) == 0:
251251
sortBy.append('weight DESC')
252252

253-
254253
# Field weights and other options
255254
# ranker=expr('sum(lcs*user_weight)*1000+bm25') == SPH_RANK_PROXIMITY_BM25
256255
# ranker=expr('sum((4*lcs+2*(min_hit_pos==1)+exact_hit)*user_weight)*1000+bm25') == SPH_RANK_SPH04
@@ -865,7 +864,7 @@ def search_url(country_code, query):
865864
# Alias without redirect
866865
@app.route('/q/<query>', defaults={'country_code': None})
867866
@app.route('/<country_code>/q/<query>')
868-
def search_url_js(country_code, query):
867+
def search_url_public(country_code, query):
869868
if NOCACHEREDIRECT:
870869
return redirect(NOCACHEREDIRECT, code=302)
871870

@@ -1121,7 +1120,7 @@ def reverse_search(lon, lat, debug):
11211120

11221121

11231122
# ---------------------------------------------------------
1124-
@app.route('/r/<lon>/<lat>')
1123+
@app.route('/r/<lon>/<lat>.js')
11251124
def reverse_search_url(lon, lat):
11261125
"""REST API for reverse_search."""
11271126
code = 400
@@ -1160,6 +1159,14 @@ def reverse_search_url(lon, lat):
11601159

11611160
return formatResponse(data, code)
11621161

1162+
1163+
@app.route('/r/<lon>/<lat>')
1164+
def reverse_search_url_public(lon, lat):
1165+
if NOCACHEREDIRECT:
1166+
return redirect(NOCACHEREDIRECT, code=302)
1167+
1168+
return reverse_search_url(lon, lat)
1169+
11631170
# =============================================================================
11641171
# End Reverse geo-coding support
11651172
# =============================================================================

0 commit comments

Comments
 (0)